Hi,
Actually I found out that NONE of the controls in the page exist when
the validation method is called. I mean even if I do a
FindControl("PicUpld") or a FindControl of ANY control the result will
always be a null reference.

However I found that the value entered in the HtmlInputFile control is
stored in ServerValidateEventArgs.Value. So I changed the method to:

protected void PicUpldVal_SrvrValidate(Object source,
ServerValidateEventArgs args)
{
   String aVal = args.Value.Trim().ToLower();
   args.IsValue = aVal.equals("") || aVal.EndsWith(".jpg") ||
                  aVal.EndsWith(".jpeg");
}


However now I ran into a different problem: Seems like the value
returned in IsValid is ignored, it doesn't matter if I change the code to:
protected void PicUpldVal_SrvrValidate(Object source,
ServerValidateEventArgs args)
{
   args.IsValue = false;
}

I can see in the debuger that the execution threat is passing through
this method, so I am sure it is being called, but no error message, or
anything is displayed on the page :(


Victor.





--- In [email protected], Dean Fiala <[EMAIL PROTECTED]>
wrote:
> Duh, of course you are using C#.  
> 
> The problem is that the input control is in the datalist (really need
> to read these more carefully), so the that you are not grabbing the
> proper reference to the control. Object source should be a reference
> to the control.  Just cast it at the top of your procedure and you
> should be all set.
> 
> PicUpld = (System.Web.UI.HtmlControls.HtmlInputFile)source;
> 
> HTH,
> 
> -- 
> Dean Fiala
> Very Practical Software, Inc
> http://www.vpsw.com





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to