Click here to Skip to main content
15,903,388 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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.
C#
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
Updated 2-Apr-13 4:47am
v2

Try using Type of UpdatePanel instead of GetType().
C#
ClientScript.RegisterStartupScript(UpdatePanelID.GetType(), "Expand", "<script language="'javascript'">expandcollapse('div" + lb.CommandArgument.ToString() + "','" + img.ClientID + "','" + flag + "'," + lb.CommandArgument.ToString() + ");</script>",false);
 
Share this answer
 
Hi,

try instead of RegisterStartUpScript, use RegisterClientScriptBlock. try like below.
C#
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.
 
Share this answer
 
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900