Click here to Skip to main content
11,584,208 members (54,774 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET

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
Edited 20-Nov-12 21:24pm
(no name)137K
Krunal R at 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 at 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 at 21-Nov-12 2:02am
hasbina at 21-Nov-12 2:26am

k.but call javascript function only one time.


n.podbielski at 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
0 OriginalGriff 390
1 Sergey Alexandrovich Kryukov 334
2 Dave Kreskowiak 240
3 Richard Deeming 220
4 virusstorm 194
0 OriginalGriff 1,663
1 Sergey Alexandrovich Kryukov 1,229
2 Abhinav S 701
3 Dave Kreskowiak 667
4 Suvendu Shekhar Giri 568

Advertise | Privacy | Mobile
Web03 | 2.8.150603.1 | Last Updated 21 Nov 2012
Copyright © CodeProject, 1999-2015
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