for (int i = 0; i < 4; i++)
{
//TextBox txtName = GridView1.Rows[i].FindControl("TextBox3") as TextBox;
TextBox txtName = (TextBox)e.Row.FindControl("TextBox3");
if (txtName != null)
{
Response.Write("NOT NULL" + txtName.Text);
}else
Response.Write("all NULL <br />" );
}
}
loop thru 4 for testing since I know that are only 3 rows
Error 3 C:\Inetpub\wwwroot\WinPorte\ICDM03-10.aspx No overload for 'gridview_RowDataBound' matches delegate 'System.EventHandler' 35
it is complaining that GridViewRowEventArgs in the function parameterprotected
void gridview_RowDataBound(object sender,
GridViewRowEventArgs e)
if I change to
protected
void gridview_RowDataBound(object sender,
EventArgs e)
then it is not complaining
Hi can anyone tell me how can i get the row no of the gridview when user clicks on the grid view or enters any data in the gird view template field when then item template is having a textbox in it.
BrigideW
Member
187 Points
138 Posts
Re: Retrieve select row.cell from Gridview and display in Textbox
Dec 18, 2007 01:34 PM|LINK
Hi Vinz,
Thanks
I got this error when trying that
so in my Gridview
OnDataBound="gridview_RowDataBound"
Code behind:
protected void gridview_RowDataBound(object sender, GridViewRowEventArgs e)
for (int i = 0; i < 4; i++){
{
//TextBox txtName = GridView1.Rows[i].FindControl("TextBox3") as TextBox;
TextBox txtName = (TextBox)e.Row.FindControl("TextBox3");
if (txtName != null)
{
Response.Write("NOT NULL" + txtName.Text);
}else
Response.Write("all NULL <br />" );
}
}
loop thru 4 for testing since I know that are only 3 rows
Error 3 C:\Inetpub\wwwroot\WinPorte\ICDM03-10.aspx No overload for 'gridview_RowDataBound' matches delegate 'System.EventHandler' 35 it is complaining that GridViewRowEventArgs in the function parameterprotected void gridview_RowDataBound(object sender, GridViewRowEventArgs e)
if I change to
protected
void gridview_RowDataBound(object sender, EventArgs e)then it is not complaining
any suggestion is greatly appreciated
vinz
All-Star
128503 Points
18155 Posts
MVP
Re: Retrieve select row.cell from Gridview and display in Textbox
Dec 19, 2007 12:13 AM|LINK
Try to put your code in PreRender event
protected void gridview_PreRender(object sender, EventArgs e)
{
//codes here
}
MessageBox Controls for WebForms | Blog | Twitter | Linkedin
naveenj
Contributor
6164 Points
1130 Posts
Re: Retrieve select row.cell from Gridview and display in Textbox
Dec 19, 2007 05:35 AM|LINK
Hi brigideW,
I noticed some mistakes
1st mistake is
OnDataBound="gridview_RowDataBound"OnRowDataBound="gridview_RowDataBound"Code behind:
2ndMistake:Dont loop through RowDataBound. it already checks each row
3rd: mistake: you didnt specify rowtype
protected void gridview_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
TextBox txtName = (TextBox)e.Row.FindControl("TextBox3");
if (txtName != null)
{
Response.Write("NOT NULL" + txtName.Text);
}
else
Response.Write("all NULL <br />" );
}
}
Check now
Regards,
naveen
Naveen Jose
ASP.NET Freelancer, Consultant
Please remember to click Mark as Answer on the post that helps you
BrigideW
Member
187 Points
138 Posts
Re: Retrieve select row.cell from Gridview and display in Textbox
Dec 21, 2007 02:06 AM|LINK
Hi naveen,
Thanks for your reply.
Yes, let me try.
Happy Holidays
ssureshmca
Member
2 Points
1 Post
Re: Retrieve select row.cell from Gridview and display in Textbox
Jan 12, 2009 10:48 AM|LINK
i need source code for this ya
Meetu Choudh...
Member
496 Points
276 Posts
MVP
Re: Retrieve select row.cell from Gridview and display in Textbox
Feb 09, 2009 07:18 AM|LINK
Hi can anyone tell me how can i get the row no of the gridview when user clicks on the grid view or enters any data in the gird view template field when then item template is having a textbox in it.
My Blog
rajkra
Member
2 Points
1 Post
Re: Retrieve select row.cell from Gridview and display in Textbox
Jul 20, 2010 12:31 PM|LINK
Thanks! This helped me in resolving an issue in a scenario