Click here to Skip to main content
13,144,679 members (34,526 online)
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...

Posted 20-Nov-12 19:34pm
Krunal R 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.

Krunal R 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170915.1 | Last Updated 21 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100