Click here to Skip to main content
12,395,577 members (55,971 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hi Karthik,

Thanks a lot it works for me..

One more issue iam facing is

On link button click i need to execute some javascript method after executing the whole server side functionality.

For this i used below line of code as a last statement in my server side method.
ClientScript.RegisterStartupScript(GetType(), "Expand", "<script language="'javascript'">expandcollapse('div" + lb.CommandArgument.ToString() + "','" + img.ClientID + "','" + flag + "'," + lb.CommandArgument.ToString() + ");</script>",false);

But somehow this javascript function is not get called may be because of update panel.

Please suggest me..

Thanks..
Posted 2-Apr-13 4:37am
Updated 2-Apr-13 4:47am
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Try using Type of UpdatePanel instead of GetType().
ClientScript.RegisterStartupScript(UpdatePanelID.GetType(), "Expand", "<script language="'javascript'">expandcollapse('div" + lb.CommandArgument.ToString() + "','" + img.ClientID + "','" + flag + "'," + lb.CommandArgument.ToString() + ");</script>",false);
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Hi,

try instead of RegisterStartUpScript, use RegisterClientScriptBlock. try like below.
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Expand", "expandcollapse('div" + lb.CommandArgument.ToString() + "','" + img.ClientID + "','" + flag + "'," + lb.CommandArgument.ToString() + ");",true);

refer Differences between RegisterStartupScript and RegisterClientScriptBlock?[^]

hope it works.
  Permalink  
Comments
BasanthiManyam 3-Apr-13 3:41am
   
Thanks Karthik..

It works..
Karthik Harve 3-Apr-13 4:04am
   
Welcome. Happy coding.:-)

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 | Mobile
Web02 | 2.8.160721.1 | Last Updated 3 Apr 2013
Copyright © CodeProject, 1999-2016
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