We'd like to remind Forumites to please avoid political debate on the Forum... Read More »
We're aware that some users are experiencing technical issues which the team are working to resolve. See the Community Noticeboard for more info. Thank you for your patience.
📨 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
Options

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
- 350.8K Banking & Borrowing
- 253.1K Reduce Debt & Boost Income
- 453.5K Spending & Discounts
- 243.8K Work, Benefits & Business
- 598.7K Mortgages, Homes & Bills
- 176.8K Life & Family
- 257.1K Travel & Transport
- 1.5M Hobbies & Leisure
- 16.1K Discuss & Feedback
- 37.6K Read-Only Boards