How to handle buton event inside datagrid
Hi All
In Datagrid with the help of template i am able to place a button like this
<asp:TemplateColumn HeaderText="Patient_id">
<ItemTemplate>
<asp:Label id=Label1 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Patient_id") %>'>
</asp:Label>
<asp:Button id="Button1" runat="server" Text="Button" OnClick="redir" ></asp:Button>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id=TextBox1 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Patient_id") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
i added redir in aspx page like this
protected sub redir( sender as object, e as eventargs)
//code
end sub
when i m invoking that with Onclick its generating the error
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@dotnet.itags.org. Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
Help Needed
Thank u
Baba
You cant use event handlers directly like that when handling events of a nested control. The nested control bubbles up its event and you can handle them as shown in this article:
http://blogs.msdn.com/paraga/archive/2005/11/26/497120.aspx
Hope this helps,
Vivek
Labels: ado, buton, button, datagrid, event, handle, headertext, inside, net, patient_id, template, thisltasptemplatecolumn
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home