How to use Linkbutton in Gridview ?

Posted by Chandru_ra under ASP.NET on 3/19/2011 | Points: 10 | Views : 7302 | Status : [Member] | Replies : 3
Dear all,

Am using Linkbutton in gridview. how to use link buttonId..


SqlConnection con = new SqlConnection(strCS);
con.Open();
SqlCommand cmd = new SqlCommand("select SchoolID from tblSchool where SchoolName='" + + "'", con);
SqlDataReader dr;
dr = cmd.ExecuteReader();
if (dr.Read())
{
SchoolID = dr[0].ToString();
}
Response.Redirect("Universitydetail.aspx?SchoolID=" + SchoolID);
//Response.Redirect("http://sharpya.in/Universitydetail.aspx?UnivID=2");
con.Close();

chandru


Responses

Posted by: Sathya4260 on: 3/19/2011 [Member] Starter | Points: 25

Up
0
Down
Try this

In grid view at the column just insert the below code

<a href='<%# Eval("Testing", "Testing.aspx?ID={0}") %>' >
<img src="Images/edit.png" alt="View" border="0px" /></a>

Sathish Kumar S

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

Posted by: Kiran2010 on: 3/20/2011 [Member] Starter | Points: 25

Up
0
Down
Try to specify ur question clearly..
Wat u wanna do??
Do u want to get the id from gridview 's link button or u wanna assign any outsider variable from that linkbutton

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

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

Up
0
Down
HI,

Please brief your question... to get immediate response!!!

Thanks
Karthik
www.f5Debug.net

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

Login to post response