hi friends,
i am using vs2005 and asp.net2.0. i am using master page,content page ,update panel within content page. Now i want to throw exception as message box with exception name in message box due to control in update panel.i am able to show exception name in text box but not in message box.
plz. help ASAP
vickyjha
![]() |
0 |
![]() |
Hi, The Follwing code Take Data from Update Panel an Shows it When U click Show Button...
Hope It Helps U
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server"><title>PageRequestManager</title>
<script language="C#" runat="server">protected override void OnLoad(EventArgs e) {
if (Session["count"] == null) {
Session["count"] = 1;
}
else {
Session["count"] = ((int)Session["count"]) + 1;
}
System.Threading.Thread.Sleep(1000);
theCount.Text = "count = " + Session["count"].ToString();
}
</script>
</head>
<body><form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" /><script type="text/javascript">
var initializeCount = 0;var beginCount = 0;
var loadingCount = 0;
var loadedCount = 0;
var endCount = 0;
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(initializeRequest);prm.add_beginRequest(beginRequest);
prm.add_pageLoading(pageLoading);
prm.add_pageLoaded(pageLoaded);
prm.add_endRequest(endRequest);
function initializeRequest(sender, initializeRequestEventArgs) {
initializeCount = initializeCount + 1;}
function beginRequest(sender, beginRequestEventArgs) {
beginCount = beginCount + 1;}
function pageLoading(sender, pageLoadingEventArgs) {
loadingCount = loadingCount + 1;}
function pageLoaded(sender, pageLoadedEventArgs) {
loadedCount = loadedCount + 1;}
function endRequest(sender, endRequestEventArgs) {
endCount = endCount + 1;}
function showCounts() {
var message = "initialized = " + initializeCount +"\r\nbegin = " + beginCount +
"\r\nloading = " + loadingCount +"\r\nloaded = " + loadedCount + "\r\nend = " + endCount;
alert(message);}
</script>
<div style="border-style:solid"><asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate><br /> <asp:Label runat="server" ID="theCount"></asp:Label><br />
<asp:Button runat="server" Text="Refresh" ID="RefreshButton" /><br /><br /></ContentTemplate>
</asp:UpdatePanel></div><br />
<input type="button" onclick="showCounts()" value="Show Counts" /></form>
</body></html>
Thanks
Avinash Tiwari
Remember to click “Mark as Answer” on the post, if it helps you.
![]() |
0 |
![]() |
try like this.. ScriptManager.RegisterClientScriptBlock(this.UpdatePanel2, typeof(string), "TEST", "alert('Message Here!');", true);
SSN
Please remember to click "Mark as Answer" on the post that helps you.
![]() |
0 |
![]() |
thanks for reply,...
but i am using master page so scriptmanager is on masterpage and update panel is on
content page and i have to throw exception as messagebox in try catch.
plz reply asap
vickyjha
![]() |
0 |
![]() |
Use script manager proxy on your child pages
![]() |
0 |
![]() |