Event on textbox in gridview

Posted by Emil under ASP.NET on 7/28/2011 | Points: 10 | Views : 4065 | Status : [Member] | Replies : 4
How to raise textboxchangeevent in textbox of gridview?




Responses

Posted by: Lalji_mer on: 7/28/2011 [Member] Bronze | Points: 25

Up
0
Down
Refer this link you will get source code

http://sudheerkondraguntaprogramming.blogspot.com/2010/12/textbox-change-event-inside-gridview.html

LP MER

Emil, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Emil on: 7/29/2011 [Member] Starter | Points: 25

Up
0
Down
Still the event is not getting called

Emil, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jpchoudhari on: 7/29/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

Can you tell more about what exactly you are doing.

Still here is a demo.
Task: Copy value of one textbox to other while typing. (both are in same row) (using javascript)

In RowDataBound Event of gridview

TextBox txtFirst = e.Row.FindControl("txtFirst") as TextBox;

TextBox txtSecond = e.Row.FindControl("txtSec") as TextBox;
if (txtFirst != null && txtSecond != null)
txtFirst.Attributes.Add("onkeyup", "javascript:txt_OnKeyDown( ' " + txtFirst.ClientID + " ',' " + txtSecond.ClientID + " ')");


And Javascript

<script type="text/javascript">

function txt_OnKeyDown(txtFirst,txtSecond) {

document.getElementById(txtSecond).value = document.getElementById(txtFirst).value;
}
</script>






Kind Regards,
Jay

Emil, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Emil on: 7/29/2011 [Member] Starter | Points: 25

Up
0
Down
I had a textox on change of that text box i want to check if that value exists in database if that value already exists
then i want to show the user that value already been used by some other user

Emil, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response