Solved

validating inputs in itemdatabound method  while updating a row in a datagrid

Posted on 2008-10-26
6
325 Views
Last Modified: 2012-06-21
Hi!
I have the following code in my aspx page
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="&lt;img src=../images/ok.gif border=0 alt=Update&gt;"CancelText="&lt;img src=../images/cancel.gif border=0 alt=Reset&gt;" EditText="&lt;img src=../images/edit.gif border=0 alt=Edit&gt;">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:EditCommandColumn>
I want to validate the fields while updating a row using javascript from the item databound method.
How do I do  a findcontrol on update button....it's an image.
Please let me know ASAP.
I'll be really greatful, if i can get the logic and teh code to do that.

IT'D EXTREMELY URGENT.I NEED IT ASAP.

THANKS A LOT IN ADVANCE
0
Comment
Question by:amukta
  • 2
6 Comments
 
LVL 8

Expert Comment

by:mkosbie
ID: 22808056
I'm not sure I understand the question.  The ItemDataBound event fires while a record is being DISPLAYED from the DB, not updated.  Also, javascript is a client side language, you can't use it for the server side ItemDataBound event.

In general, if you want to validate your inputs, you should use ASP.NETs built in validation controls: http://www.w3schools.com/aspnet/aspnet_refvalidationcontrols.asp
0
 

Author Comment

by:amukta
ID: 22808095
I'm not supposed to use the validation controls. yes. I know itemdatabound fires when the row displays.
But I need to validate the controls using javascript. I'm able to do it for add
the add button is a link button. But I'm unable to do a find control for update button as it's an image as u can see in the above code.

Can u plz. help me know how do to a find control for update
I can handle the rest.
The update button has a text as image inside the edit command column.
how can I do a find control....since, there's no id.

I need it ASAP.
IT'S EXTREMELY URGENT.

0
 
LVL 13

Accepted Solution

by:
sm394 earned 500 total points
ID: 22808350
i cant help you exactly but this may help
http://aspnet.4guysfromrolla.com/articles/090902-1.2.aspx
check section When the "Edit" Button is Clicked.....
0
 
LVL 13

Expert Comment

by:sm394
ID: 22808368
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adjust the position 3 48
Name space syntax error 12 40
When should I use a controller? 3 10
rebind a grid after user clicks on node in treeview 1 5
AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now