how to use lable and linkbutton in gridview
Posted by under ASP.NET category on | Points: 40 | Views : 2843
<asp:GridView ID="CustomerView" ToolTip="Click model get more information" 
<asp:TemplateField HeaderText="Brand">
<asp:Label ID="lblbrand" runat="server" Text='<%#Eval("brand") %>' ></asp:Label>
<asp:TemplateField HeaderText="Model">
<asp:LinkButton runat="server" ID="linkmodel" Text='<%#Eval("model") %>'
onclick="linkmodel_Click " ></asp:LinkButton>
<ItemStyle Font-Overline="False" Font-Size="X-Small" Font-Underline="False" />


 protected void linkmodel_Click(object sender, EventArgs e)
GridViewRow clickedRow = ((LinkButton)sender).NamingContainer as GridViewRow;
Label lblID = (Label)clickedRow.FindControl("lblbrand ");
string brand = lblID.Text;
LinkButton linkmodel = sender as LinkButton;
string model = linkmodel.Text;

Comments or Responses

Login to post response