A Maddening Problem Solved. But why??

  • Thread starter David Hirschfeld
  • Start date
D

David Hirschfeld

A while back I learned how to create a default button
click event when the enter key is pressed by inserting
the following code:

Page.RegisterHiddenField("__EVENTTARGET", "butSearch")

However, I originally implemented incorrectly as follows:

Page.RegisterHiddenField("__EventTarget", "butSearch")

The only difference is the case of __EventTarget. Both
methods work. However, if you are using User Controls as
I am, and if you have one user control for the header of
your web page, and another User Control for the content
with an embedded DataGrid control, the 'Mixed Case'
version disables both paging and sorting. I can only
guess why this happens. It took me a couple days to
figure out what happened to my paging and sorting.

The difference in HTML output between these two versions
is as follows.

'All Caps' - Correct
<input type="hidden" name="__EVENTTARGET"
value="butSearch" />
<input type="hidden" name="__EVENTARGUMENT" value="" />

'Mixed Case' - Incorrect
<input type="hidden" name="__EventTarget"
value="butSearch" />
<input type="hidden" name="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" value="" />

I can only guess that both the Sort and Paging commands
share the hidden input with many other default postback
actions. The additional 'Mixed Case' hidden input,
somehow overrides the 'All Caps' input. If someone has a
more insightful explanation, I would like to hear it.
Regardless, developers should be made aware of this
idiosyncrasy.
 
M

Mike Moore [MSFT]

Hi David,

I have reviewed your issue. Due to the nature of your issue I need to do
additional research to determine the best way to provide assistance.
Someone will contact you as soon as possible.

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security.

This posting is provided "AS IS", with no warranties, and confers no rights.


--------------------
 
D

David Hirschfeld

As I said in my original post, I no longer have a problem, only a
question as to why it works the way it does. And, my guess is that it
is a Visual Studio bug. However, if you would like to see a sample
project that illustrates the behaviour I documented in my earlier post,
I can email it to you.
 
J

Jim Cheshire [MSFT]

Hi David,

I have reviewed your post. If you'd care to send me your project to test,
please do so. You can send it to the e-mail address on this post. Just
leave off the "online".

I'm not exactly sure why you are seeing this behavior without seeing a
repro of the behavior. I can tell you that the __doPostBack client side
event refers to the form field as _EVENTTARGET, but the truth is that
Internet Explorer doesn't really care about the case.

I'll be glad to look at your sample. As long as I can reproduce it (and it
sounds as though I will be able to), I'll try and determine why it happens
for you. If it gets too in-depth, we might not be able to work it to
completion in a newsgroup post.

Let me know.

Jim Cheshire [MSFT]
Developer Support
ASP.NET
(e-mail address removed)

This post is provided as-is with no warranties and confers no rights.

--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,888
Messages
2,569,964
Members
46,293
Latest member
BonnieHamb

Latest Threads

Top