| | |
/forums/clientscript.RegisterClientScriptBlock doesnot work in UpdatePanel
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2009
Posts: 41
Reputation:
Solved Threads: 1
Hi friends..
I am trying to display message box using server-side code. I have written code in buttons click event and Page Load Event. It is as follows :
If button is not in UPDATE PANEL, then both alert are displayed normally (i.e. during Page Load and Button Click)
But when I put the button inside UPDATE PANEL , alert dosn't work in Button Click. Here only Page_Load alert is displayed
In case of UPDATE PANEL is also tried
Me.UpdatePane1.GetType()
but in vain..!!!
Any ideas??
I am trying to display message box using server-side code. I have written code in buttons click event and Page Load Event. It is as follows :
ASP.NET Syntax (Toggle Plain Text)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load TextBox1.Text = "I Enjoy ASP.NET" Dim myscript As String = "alert(document.getElementById('TextBox1').value);" Page.ClientScript.RegisterStartupScript(Me.GetType(), "myscript", myscript, True) End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim strMessage As String strMessage = "Hi, You clicked ClickMe button" Dim strScript As String = "<script language=JavaScript>" strScript += "alert('" & strMessage & "');" strScript += "</script>" If (Not ClientScript.IsStartupScriptRegistered("clientScript")) Then ClientScript.RegisterClientScriptBlock(Me.GetType(), "clientScript", strScript) End If End Sub
If button is not in UPDATE PANEL, then both alert are displayed normally (i.e. during Page Load and Button Click)
But when I put the button inside UPDATE PANEL , alert dosn't work in Button Click. Here only Page_Load alert is displayed
In case of UPDATE PANEL is also tried
Me.UpdatePane1.GetType()
but in vain..!!!
Any ideas??
![]() |
Other Threads in the ASP.NET Forum
- Previous Thread: Subtract a date from other
- Next Thread: How to check the checkbox in datagridview is checked or not.
| Thread Tools | Search this Thread |
.net 2.0 activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox child click commonfunctions compatible confirmationcodegeneration content contenttype courier css dataaccesslayer database datagrid datagridview datagridviewcheckbox datalist deadlock development dgv dropdownlist dropdownmenu edit expose feedback flash flv form formatdecimal forms formview gridview homeedition iframe iis javascript jquery listbox login menu microsoft mono mouse mssql multistepregistration news numerical objects order panelmasterpagebuttoncontrols parent radio ratings reportemail rotatepage save schoolproject search security serializesmo.table silverlight smartcard software sql-server sqlserver2005 suse textbox tracking typeof unauthorized validation vb.net video videos virtualdirectory vista visual-studio visualstudio web webapplications webarchitecture webdevelopemnt webprogramming webservice xml youareanotmemberofthedebuggerusers





