how do i invoke link button controls click method in the datalist ???
Suppose link button control will send info back to server and redirect to
another page, how do i do it in datalist ?
I have following code in item templatae
<asp:LinkButton id="Linkbutton1" OnClick="OnClickMethod"
I want to be able to pass arguement to OnClickMethod [the arguement is
employee_id which comes from the table]
Something like when link button is clicked, it'll redirect to another page
containing employee details.
protected void _dataList_ItemCommand(object source, DataListCommandEventArgs
if (e.CommandName == "DoSomething")
int employee_id = (int)_dataList.DataKeys[e.Item.ItemIndex];
// now do something with
But if your going to do all of this simply for a redirect, then it's much
simpler to just emit a hyperlink to the browser in the first place. This
also can be accomplished in your ItemTempate:
<asp:HyperLink runat="server" Text="Something"