Creating a Custom Button in a ListView in ASP.NET -
i have results.aspx page displays resulting records queried using sqldatasource object via listview. want add "view" button appear next each record, , when clicked take me separate page display details record. how accomplish this?
edit
i have tried said, citronas , here's i've come with:
<td> <asp:checkbox id="checkbox1" runat="server" /> </td> <td> <asp:linkbutton id="linkbutton1" runat="server" commandname="viewbuttonclick" commandargument='<%# eval("serviceid") %>'>view</asp:linkbutton> </td>
and here method want called:
protected void viewbuttonclick(object sender, commandeventargs e) { var serviceid = convert.toint32(e.commandargument); servicetoview = dataaccesslayer.service.select(new service { serviceid = serviceid }); server.transfer("~/viewservice.aspx"); }
unfortunately nothing happens...am missing something?
edit -- fixed
i missing something! had commandname equal method name instead of oncommand. took out commandname, kept argument bit , replaced commandname oncommand. works now, ever need commandname for?
you can add linkbutton itemtemplate of listview.
bind value identifies each record commandargument of linkbutton.
subscribe command-event of linkbutton. there have access commandeventargs.commandargument
Comments
Post a Comment