We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
Weird .NET gridview behaviour

dave82_2
Posts: 1,328 Forumite
in Techie Stuff
Hi,
If I create a databound grid view with a footer containing a textbox and a button. The button has the attribute
CommandName="Add" set When I press enter in the textbox a postback occurs however the GridViews RowCommand event does not fire. If I add a second text box the RowCommand event does fire!
Anyone able to help?
Cheers Dave
If I create a databound grid view with a footer containing a textbox and a button. The button has the attribute
CommandName="Add" set When I press enter in the textbox a postback occurs however the GridViews RowCommand event does not fire. If I add a second text box the RowCommand event does fire!
Anyone able to help?
Cheers Dave
0
Comments
-
So basically if I do this
<FooterTemplate> <asp:TextBox ID="tbxQuantity" runat="server"></asp:TextBox> </FooterTemplate>
it doesn't fire the GridView RowCommand even when I press enter in the textbox
If I do this it does fire the GridView RowCommand event!!
[/SIZE] <FooterTemplate> <asp:TextBox ID="tbxQuantity" runat="server"></asp:TextBox> <asp:TextBox ID="stupidfix" runat="server" style="display:none"></asp:TextBox> </FooterTemplate>
0 -
Its a 'Feature' in asp.net webforms.
Beacuse asp.net webforms demands only 1 runat server form, it creates problems when you hit enter (ie does a form submit),and it normall tries work out what text box you pressed enter in.
When you only have a single textbox on the page, it automaticaly assumes that textbox was source and seems to bypass the control checking and doesn't do the correct postback.0 -
Cheers. Got to love these microsoft 'features' :j0
This discussion has been closed.
Confirm your email address to Create Threads and Reply

Categories
- All Categories
- 351.7K Banking & Borrowing
- 253.4K Reduce Debt & Boost Income
- 454K Spending & Discounts
- 244.7K Work, Benefits & Business
- 600.1K Mortgages, Homes & Bills
- 177.3K Life & Family
- 258.4K Travel & Transport
- 1.5M Hobbies & Leisure
- 16.2K Discuss & Feedback
- 37.6K Read-Only Boards