Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 10, 2013 05:52 AM by alankarp
Participant
1128 Points
1307 Posts
Jan 09, 2013 09:29 PM|LINK
Hello,
Below is my code. OnRowCommand is firing for Command Field but If I use template field it is not working.
Here is Code.
<asp:TemplateField ShowHeader="False" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center" > <ItemTemplate> <asp:Button ID="Button1" runat="server" CommandName="AddUser" Text="Add" /> </ItemTemplate> </asp:TemplateField> <asp:CommandField ButtonType="Button" ShowHeader="false" ShowSelectButton="true" />
Contributor
2042 Points
345 Posts
Jan 10, 2013 05:52 AM|LINK
Reason 1: you are binding gridview on postback, you must not bind your grid on postbacks in Page_Load, only when something changed that causes the Grid to reload data(f.e. Sorting,Paging) and only in the appropriate even-handlers. Reasone 2: Disabled ViewState
Please check above two things
ramll
Participant
1128 Points
1307 Posts
OnRowCommand Not Firing
Jan 09, 2013 09:29 PM|LINK
Hello,
Below is my code. OnRowCommand is firing for Command Field but If I use template field it is not working.
Here is Code.
<asp:TemplateField ShowHeader="False" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center" > <ItemTemplate> <asp:Button ID="Button1" runat="server" CommandName="AddUser" Text="Add" /> </ItemTemplate> </asp:TemplateField> <asp:CommandField ButtonType="Button" ShowHeader="false" ShowSelectButton="true" />alankarp
Contributor
2042 Points
345 Posts
Re: OnRowCommand Not Firing
Jan 10, 2013 05:52 AM|LINK
Reason 1: you are binding gridview on postback, you must not bind your grid on postbacks in Page_Load, only when something changed that causes the Grid to reload data(f.e. Sorting,Paging) and only in the appropriate even-handlers.
Reasone 2: Disabled ViewState
Please check above two things
Profile