Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am calling the JavaScript function 'findLocation()' as below,
C#
for (int i = 0; i < oDataSet.Tables[0].Rows.Count; i++)
{
     hdnLocation.Value = oDataSet.Tables[0].Rows[i][4].ToString();
     hdnrowIndex.Value = i.ToString();                             
     ScriptManager.RegisterStartupScript(this, this.GetType(), "alertScript", "findLocation()", true);                  
}

But it takes only the last row column value.

Please help me...

Thanks...
Posted
v3
Comments
[no name] 21-Nov-12 1:39am    
"RegisterStartupScript" does not execute your java script from your C# (server side) code. It only registers the script in your aspx page. This java script will be executed once the execution is completed at server and page is reloaded at client.
hasbina 21-Nov-12 1:56am    
@krunal

Then how to call javascript function from server side?
The javscript function set the value of hidden field.

Thanks...
[no name] 21-Nov-12 2:02am    
http://www.codeproject.com/Questions/367597/Calling-javascript-function-from-server-side-not-w
hasbina 21-Nov-12 2:26am    
@krunal

k.but call javascript function only one time.

why?

Thanks..
n.podbielski 21-Nov-12 3:48am    
Crap. I saw question like this here not time ago. Even when you call this multiple time, it's still gonna do ONE thing multiple times since you will have in your hidden field value from last row. Try something else.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900