Click here to Skip to main content
14,635,966 members
Rate this:
Please Sign up or sign in to vote.
See more:

I am calling the JavaScript function 'findLocation()' as below,
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...

[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

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

[no name] 21-Nov-12 2:02am
hasbina 21-Nov-12 2:26am

k.but call javascript function only one time.


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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100