Validate FileUpload inside gridview once the checkbox is checked..

Posted by Gopal_nivas under ASP.NET on 2/4/2011 | Points: 10 | Views : 2752 | Status : [Member] | Replies : 4
hi..
i want to Validate FileUpload inside gridview once the checkbox is checked..(checkbox too placed inside gridview only)

how to do this..

need ur suggestions with examples

regards
gopal.s




Responses

Posted by: Karthikanbarasan on: 2/4/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi Gopal.

U have the file upload control inside the gridview along with a checkbox? And what validation u need to check? Can you post ur requirement brief so that we can give a solution.

Thanks
Karthik
www.f5Debug.net

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gopal_nivas on: 2/4/2011 [Member] Starter | Points: 25

Up
0
Down
hi karthik,


if i checked the checkbox for particular row ,in tat i am having fileupload control,then tat ro file upload control cannot be empty .so how to validate tat..(it is applicable for n no. of rows)

unchecked checkbox rows file upload control will be 0. and it is inserted into db as 0.
but if i checked the checkbox i have to give the files in file upload control

regards
gopal.s


Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 2/4/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi,

You can try this

[code]
protected void gridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow row = gridView.Rows[e.RowIndex];
FileUpload fileUpload = row.Cells[0].FindControl("fileUpload1") as FileUpload;
if (fileUpload != null && fileUpload.HasFile)
{
//Insert the file here
}
else
{
Check if the Checkbox is checked or not here and insert as 0
}
}
[\code]


Thanks
Karthik
www.f5Debug.net

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gopal_nivas on: 2/28/2011 [Member] Starter | Points: 25

Up
0
Down
hi karthik..

thanks for ur coding..

is it possible to do this using java script..

if possible means give me some example for that..

need ur suggestions
regards
gopal.s

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response