I need to add onclick method to textbox inside grid.In this scenerio i can bind the client id the get the value of that grid item inside javascript method or can bind directly the value to the javascript method which is the best way for implementation
1. binding the client id and getting the value
txtbx1.attributes.add("onclick","Getvalues('txtbx1')");
2. Bind value directly to the method
txtbx1.attributes.add("onclick","Getvalues('20')");
Loading

Jignesh TrivediPosted May 20, 2014, 3:12 AM
Ideally both are same in 1st case probably you send whole object of textbox (may be using txtbx1.attributes.add("onclick","Getvalues(this)"); ) and 2nd one you send the value of text box.
Nilesh AvhadPosted May 20, 2014, 5:40 AM
I will prefer 1st one.
Thanks,
Nilesh
Akhil MittalPosted May 20, 2014, 4:31 AM
Yadlapalli SrikanthPosted May 20, 2014, 3:51 AM
Yadlapalli SrikanthPosted May 20, 2014, 3:23 AM
Anupam SinghPosted May 20, 2014, 3:07 AM
Yadlapalli SrikanthPosted May 20, 2014, 3:04 AM
Anupam SinghPosted May 20, 2014, 3:01 AM
because there should not be hard-coded value in method parameter.
Yadlapalli SrikanthPosted May 20, 2014, 2:59 AM
in case of the column is editable i can use the first one but it is not editable.It is a constant so i can pass the value directly.can you explain why the first one is best
Anupam SinghPosted May 20, 2014, 2:55 AM
But i dont think it should work like this..
because your GetValues(Type t) method might take int type of parameter.
you should use GetValues(Convert.ToInt32(txtbx1.Text)).