Passing value to javascript function "onload" event from datagrid
Hi all,
Very much confuse with this.
I have a datagrid, and i am able to pass the value to javascript function through "onclick" event as below:
e.item.attributes.add("onclick","javascript:myfunction('"+value1+"');");
but, when i am trying to pass the value of the first row on datagrid through "onload" event as below:
dg.Items[0].Attributes.Add("onload","javascript:myfunction('"+value1+"');");
it's not passing the value.
I have to use onload event, so i can display default value th' javascript function.
Any help will be appreciated.
Thanks,
NIKI
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Anwar Buchoo89 reputationPosted Jun 29, 2006, 11:31 PM EDT
Someting like:
Button MyBtn = dg.FindControl("btnOk");
MyBtn.Attribtutes.Add("function goes here");
and this within the datagrid's OnDataBound event.
Dhruvil13 reputationPosted Jun 30, 2006, 4:26 AM EDT