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!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide
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
- 353.5K Banking & Borrowing
- 254.2K Reduce Debt & Boost Income
- 455.1K Spending & Discounts
- 246.6K Work, Benefits & Business
- 602.9K Mortgages, Homes & Bills
- 178.1K Life & Family
- 260.6K Travel & Transport
- 1.5M Hobbies & Leisure
- 16K Discuss & Feedback
- 37.7K Read-Only Boards