This is a migrated thread and some comments may be shown as answers.

Giving message to user from code behind in popup

2 Answers 81 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
vairam
Top achievements
Rank 1
vairam asked on 19 Dec 2008, 11:42 AM
Hi

I want to give a message to user in pop up depends on his role from code behind.
All my controls are in update panel.
Here is my samplecode
but First time when i click the button1 the message display one time only.
If i click the second time the message coming twice.Even when i click the button2 that time also the message coming.
That means every time of  asynchronous call the message will be displaying.But what i want is the message will be display only once when i click the button1 .I dont want message when i click any other controls.

 

 

<

telerik:RadCodeBlock ID="RadCodeBlock" runat="server">

 

 

 

 

 

<script language="javascript" type="text/javascript" >

 

 

function openwindow(test)

 

{

alert(test);

 

}

 

 

</script>

 

 

 

 

 

</telerik:RadCodeBlock>

 

 

 

 

 

<table><tr><td>

 

 

 

 

 

<div style="text-align:center; width:600px">

 

 

 

 

 

</div></td></tr></table>

 

 

 

<telerik:RadScriptManager ID="RadScriptManager1" runat="server">

 

 

 

 

 

</telerik:RadScriptManager>

 

 

 

 

 

<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px" Style="position: static"

 

 

 

 

 

Width="696px">

 

 

 

 

 

<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Style="position: static"

 

 

 

 

 

Text="Button" Width="128px" />

 

 

 

 

 

<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Style="position: static"

 

 

 

 

 

Text="Button" Width="136px" /></telerik:RadAjaxPanel>

 

 



protected
void Button1_Click(object sender, EventArgs e)

 

{

 

ScriptManager.RegisterStartupScript(Page, typeof(Page), "RadAlertScript", "Sys.Application.add_load(function(){openwindow('test');});", true);

 

}

 

protected void Button2_Click(object sender, EventArgs e)

 

{

}



2 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 19 Dec 2008, 02:55 PM
Hi Vairam,

In this case you could use the ResponseScripts collection of the RadAjaxPanel to execute the custom script on particular ButtonClick event. Please find attached a sample application which shows this functionality.

Regards,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
vairam
Top achievements
Rank 1
answered on 20 Dec 2008, 05:19 AM
Hi Maria

Thanks for your response

My problem has solved i have used this code

ScriptManager.RegisterStartupScript(Page, typeof(Page), "RadAlertScript", "openwindow('test')", true);

Thanks
Vairam
Tags
Ajax
Asked by
vairam
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
vairam
Top achievements
Rank 1
Share this question
or