.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Gridview inside file upload control validation.

Posted By: gopal     Posted Date: February 25, 2011    Points:2   Category :ASP.Net
hi..

i have a gridview in that i have checkbox and file upload controls and common submit button outside gridview.

if i checked a row checkbox and i need to check whether the file upload control contains any value or not.

if not means i will show a message.

if not checked means its not a problem no need to validate the control.

how to do this..

need ur suggestions with examples
regards
gopal.s

Responses
Author: Sunil Yadav       [Moderator]      
Posted Date: February 25, 2011     Points: 5   

Hi,

You can achive this on CheckedChanged on checkbox.

Check out the code snippete below.

 void chkbox_CheckedChanged(object sender, EventArgs e)
{
CheckBox chkbox = sender as CheckBox;
if (chkbox.Checked)
{
GridViewRow gvRow = (GridViewRow)chkbox.NamingContainer;
FileUpload fld = gvRow.FindControl("fileupload1") as FileUpload;
if (!fld.HasFile)
{
// TODO : LOG ERROR
}
}
}


Let me know if you need any help.

Author: gopal             
Posted Date: February 28, 2011     Points: 20   

hi sunil..

thanks for ur reply..

is it possible to do this in javascript..
if possible means give some examples for that..

need ur suggestions
regards
gopal.s



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend