Click here to Skip to main content
Sign Up to vote bad
good
See more: ASP.NET
Hi,
 
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...
 
Thanks...
Posted 20 Nov '12 - 19:34
hasbina821
Edited 20 Nov '12 - 21:24
Tadit Dash23.1K

Comments
Krunal R - 21 Nov '12 - 1:39
"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:56
@krunal Then how to call javascript function from server side? The javscript function set the value of hidden field. Thanks...
Krunal R - 21 Nov '12 - 2:02
http://www.codeproject.com/Questions/367597/Calling-javascript-function-from-server-side-not-w
hasbina - 21 Nov '12 - 2:26
@krunal k.but call javascript function only one time. why? Thanks..
n.podbielski - 21 Nov '12 - 3:48
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
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 449
1 Arun Vasu 253
2 OriginalGriff 210
3 CPallini 163
4 Aarti Meswania 158
0 Sergey Alexandrovich Kryukov 10,129
1 OriginalGriff 7,749
2 CPallini 4,181
3 Rohan Leuva 3,482
4 Maciej Los 2,999


Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 21 Nov 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid