Datagrid, validation and scroll position...

B

Ben

Hi, I have a page with a datagrid that you have to scroll to see. I'm using
the StrengthControls SmartScroller as recommended to maintain my scroll
position.

Anyway, inside the datagrid I have fields that require validation. No
problem, I put the validators on them and they work just fine... Except for
the fact that when a user has an invalid entry and fires a validation event
client side the scroll position is reset to the top of the page...

I tried disabling client script and validating server side only, but the
validators inside the datagrid don't see to fire server side...

Any ideas?

Thanks,
Ben
 
S

Steven Cheng[MSFT]

Hi Ben,

As for the Validation Control for the nested entry fields in DataGrid's
columns problem, this does be a normal behavior when we use validation
control in the sub container of a template databound control. Such as
DataGrid, DataList or Repeater, these template databound controls has no
design-time defined nested child controls. Their sub controls are
dynamically generated via the datasource bound to it. And each child
control's id will have a index number at the end of it. So the serverside
validation will not work for such scenario. And we need to use clientside
script to perform the validation.

In addition, as you mentioned that when you use clientside validation, the
postiion of the page will auto reset to top of the page after the client
validation occur. But based on my test( I use a RequiredFieldValidator) ,
the page will remain the position where the RequiredFieldValidator located.
Have you used a ValidationSummary control? Maybe it will be the cause of
the problem.
Anyway, if you have anyother findings or ideas, please feel free to post
here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
B

Ben

I am using a validation summary. It seems like the only 'presentable' way
to display an error message with any information when you have a problem
inside a datagrid.
 
S

Steven Cheng[MSFT]

Hi Ben,

Thanks for your response. En, the Validation Summury is a good one to
display the validation errors on the webform. However, I think it is also
the cause of the problem that the page will reset to the validationSummary
's position after the validation, do you think so?
And based on my test, if I don't use validationSummary, just let the
validatoin control itself display error message, when the validation error
occurs, the page's position will remain at the validation control which is
displaying the error. I tested use the RequiredFieldValidator control (Put
it in a datagrid's cell and together with another textbox).

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 

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

Top