c# - How to bind data to linkbutton without interfering with other boundfields? -


there few gridviews in page. first gridview editable, second not. first gridview has column has hyperlink (linkbutton). second table should loaded based on click event of above hyper link. expecting hyperlink behave button. can done?

in order try, not sure start. added hyperlink first gridview column. set navigationurl doubtful me.

there handful of events in hyperlink control. enter image description here

none of seems need. tutorial valuable.

update: gird markup code

<div id="schedule">     <asp:gridview id="gvschedule"          runat="server" autogeneratecolumns="false"          cssclass="grid"          datakeynames="employee id, woy, location"          showheader="false"          rowstyle-cssclass="rowstyle"         onrowdatabound="gvschedule_rowdatabound">     <columns>  <asp:boundfield headertext="staff"       datafield="e_name" sortexpression="e_name"        itemstyle-width="113" />     </columns>      </asp:gridview>     <br /> </div> 

tried out linkbutton per this solution here

<asp:templatefield headertext="staffclick" sortexpression="stock no" itemstyle-width="50">         <itemtemplate>            <asp:linkbutton id="lblstaff" runat="server">click</asp:linkbutton>         </itemtemplate>         <headerstyle backcolor="black" forecolor="white" horizontalalign="left"/>         <itemstyle horizontalalign="left" />         </asp:templatefield> 

after using code, none of fields checkboxes loaded rowbound event.

put linkbutton in gridview, , use "rowcommand" action set what's supposed happen. link gets clicked, event called rowcommand dispatched. can handle whatever needs happen server-side.

commandargument can want pass function on server side.

here's example:

 <asp:button id="btnviewmore"           commandargument="<%# ((gridviewrow) container).rowindex %>         " commandname="more" runat="server" text="view more" /> 

and on server side (c#):

protected void gridmemberslist_rowcommand(object sender, gridviewcommandeventargs e) {     if (e.commandname == "more")     {         int index = convert.toint32(e.commandargument.tostring());         // command , commandargument, instance, update second gridview     } }   

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -