Answered by:
Ajax TabContainer Control hide when Message alert open

Question
-
User546321960 posted
<ajax:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </ajax:ToolkitScriptManager> <asp:UpdatePanel ID="updPanel" runat="server"> <ContentTemplate> <div class="container"> <div class="title"> <h1 class="heading_tag">Ticket</h1> </div> <div class="buttons" style=""> <asp:Button ID="btnSave" runat="server" Text="Save" CssClass="myButton" ValidationGroup="SaveTicket" OnClick="btnSave_Click" /> <a href="#" class="myButton">Cancel</a> <a href="#" class="myButton">Print</a> </div> <div class="clear"></div> <hr class="hr" /> <fieldset> <legend>Customer Ticket Detail </legend> <table class="tbal_main" cellspacing="0" cellpadding="3"> <tr> <td width="15%">Customer Name :</td> <td width="25%"> <asp:TextBox ID="txtCustomer" runat="server" CssClass="input_text" Style="width: 380px" /> <asp:RequiredFieldValidator ID="rfv1" ControlToValidate="txtCustomer" CssClass="valid" SetFocusOnError="true" Display="None" ValidationGroup="SaveTicket" runat="server" ErrorMessage="Enter Customer Name"></asp:RequiredFieldValidator> </td> <td width="15%">Product :</td> <td> <asp:DropDownList ID="drpProduct" CssClass="select" runat="server"> </asp:DropDownList> <asp:RequiredFieldValidator ID="rfv2" ControlToValidate="drpProduct" CssClass="valid" SetFocusOnError="true" Display="None" InitialValue="0" ValidationGroup="SaveTicket" runat="server" ErrorMessage="Select Product"></asp:RequiredFieldValidator> </td> <td>Priority :</td> <td align="right"> <asp:DropDownList ID="drpPriority" CssClass="select" runat="server"> </asp:DropDownList> <asp:RequiredFieldValidator ID="rfv3" ControlToValidate="drpPriority" CssClass="valid" SetFocusOnError="true" Display="None" InitialValue="0" ValidationGroup="SaveTicket" runat="server" ErrorMessage="Select Priority"></asp:RequiredFieldValidator> </td> </tr> </table> </fieldset> <div> <ajax:TabContainer ID="TabContainer" runat="server"> <ajax:TabPanel ID="tab1" runat="server"> <HeaderTemplate> Comments </HeaderTemplate> <ContentTemplate> <table style="width: 100%; padding: 14px 14px 14px 14px" class="datagrid" cellspacing="3" cellpadding="3"> <tr> <td valign="top" style="width: 60%">Description :<br /> <asp:TextBox ID="txtCommentDescription" runat="server" TextMode="MultiLine" Style="width: 680px; border-color: #aaaaaa; height: 85px;" /> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtCommentDescription" CssClass="valid" SetFocusOnError="true" Display="None" ValidationGroup="CommentError" runat="server" ErrorMessage="Enter Description"></asp:RequiredFieldValidator> </td> <td align="left" valign="middle"> <asp:Button ID="btnComments" runat="server" Text="Add Comment" CssClass="myButton" ValidationGroup="CommentError" OnClick="btnComments_Click" /> </td> </tr> <tr> <td colspan="2"> </td> </tr> </table> </ContentTemplate> </ajax:TabPanel> <ajax:TabPanel ID="tab2" runat="server"> <HeaderTemplate> Attachments </HeaderTemplate> <ContentTemplate> <table style="width: 100%; padding: 14px 14px 14px 14px" class="datagrid" cellspacing="3" cellpadding="3"> <tr> <td valign="top">Attachments :<br /> <asp:FileUpload ID="attachedfile" runat="server" CssClass="myButton_small" /> <asp:CustomValidator ID="cstFile" runat="Server" ControlToValidate="attachedfile" ErrorMessage="Invalid Attachment Type" Display="None" ValidationGroup="attach" ClientValidationFunction="ValidateAttachmentType"></asp:CustomValidator> <asp:Button ID="btnAttachment" runat="server" Text="Add Attachment" CssClass="myButton" ValidationGroup="attach" OnClick="btnAttachment_Click" /> </td> </tr> </table> </ContentTemplate> </ajax:TabPanel> <ajax:TabPanel ID="tab3" runat="server"> <HeaderTemplate> Email Notifications </HeaderTemplate> <ContentTemplate> <p class="myButton_small"> <asp:Button ID="btnEmail" runat="server" Text="Save" CssClass="myButton" ValidationGroup="EmailVerification" OnClick="btnEmail_Click" /></p> </ContentTemplate> </ajax:TabPanel> </ajax:TabContainer> </div> <div> <asp:Label ID="lblError" runat="server" Text="REcord adsad"></asp:Label> </div> </div> </ContentTemplate> </asp:UpdatePanel> <asp:UpdateProgress ID="updateProgress" runat="server"> <ProgressTemplate> <div class="ModalBackGround"> </div> <div class="updateProgress"> <img src="Images/ajx-loader.gif" alt="Please Wait..." /> </div> </ProgressTemplate> </asp:UpdateProgress>
protected void btnSave_Click(object sender, EventArgs e) { TicketMaster objTicket = new TicketMaster(); objTicket.TicketID = PK_TicketID; objTicket.Title = txtTitle.Text; objTicket.ProductFK = Convert.ToInt32(drpProduct.SelectedValue); objTicket.PriorityFK = Convert.ToInt32(drpPriority.SelectedValue); objTicket.ExceptedDate = Globals.FormatNullDate(txtExpCompletion.Text); objTicket.Description = txtDescription.Text; objTicket.StatusFK = Convert.ToInt32(drpStatus.SelectedValue); objTicket.AssignedFK = Convert.ToInt32(drpAssigned.SelectedValue); objTicket.ActionAt = Globals.FormatNullDate(txtActionedAt.Text); objTicket.CompletedBy = Convert.ToInt32(drpCompletedBy.SelectedValue); objTicket.Solution = txtSolution.Text; objTicket.CreatedUserID = Convert.ToInt32(Sessions.UserID); objTicket.CreatedDT = DateTime.Now; objTicket.UpdatedUserID = Convert.ToInt32(Sessions.UserID); objTicket.UpdatedDT = DateTime.Now; try { objTicket = objTicket.Save(objTicket); } catch (Exception Ex) { lblError.Text = Ex.Message; } if (objTicket.TicketID > 0) { PK_TicketID = objTicket.TicketID; if (PK_CommentId > 0) { ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('Record Updated Successfully');", true); } else { ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('Record Save Successfully');", true); } BindForEdit(); } }
Hello, AllI am Using ajax:TabContainer Tab Control in My Page
All are Working fine and this tab control is working fine, but one issue occurring now when I Press Save Button Click event in above my code and alert message display but this time all Tab Control hide and after when I message box close then show all control
I am using ScriptManager.RegisterClientScriptBlock method but this page is not showing tab control when message open
Please give me your feedback
Thanks
AP
Tuesday, February 18, 2014 7:58 AM
Answers
-
User-933407369 posted
hi,
You use the RegisterClientScriptBlock method to register a client script block that is compatible with partial-page rendering and that has no Microsoft Ajax Library dependencies. Client script blocks that are registered by using this method are sent to the page only when control represents a control that is inside an UpdatePanel control that is being updated. To register a script block every time that an asynchronous postback occurs, use the RegisterClientScriptBlock(Page, Type, String, String, Boolean) overload of this method.
If you want to register a script block that does not pertain to partial-page updates, and if you want to register the script block only one time during initial page rendering, use the RegisterClientScriptBlock method of the ClientScriptManager class. You can get a reference to the ClientScriptManager object from the ClientScript property of the page.
According to your description, i would suggest you try using the codes to register the function to page:
if (dd) { this.ClientScript.RegisterClientScriptBlock( this.Page.GetType(), "alert", "alert('Record Updated Successfully');", true); // ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('Record Updated Successfully');", true); } else { this.ClientScript.RegisterClientScriptBlock( this.Page.GetType(), "alert", "alert('Record Updated Successfully');", true); // ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('Record Save Successfully');", true); }
please refer to the link for details:
ScriptManager.RegisterClientScriptBlock Method
http://msdn.microsoft.com/en-us/library/bb350750(v=vs.110).aspx
Hope it helps you.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, February 19, 2014 1:54 AM
All replies
-
User-933407369 posted
hi,
You use the RegisterClientScriptBlock method to register a client script block that is compatible with partial-page rendering and that has no Microsoft Ajax Library dependencies. Client script blocks that are registered by using this method are sent to the page only when control represents a control that is inside an UpdatePanel control that is being updated. To register a script block every time that an asynchronous postback occurs, use the RegisterClientScriptBlock(Page, Type, String, String, Boolean) overload of this method.
If you want to register a script block that does not pertain to partial-page updates, and if you want to register the script block only one time during initial page rendering, use the RegisterClientScriptBlock method of the ClientScriptManager class. You can get a reference to the ClientScriptManager object from the ClientScript property of the page.
According to your description, i would suggest you try using the codes to register the function to page:
if (dd) { this.ClientScript.RegisterClientScriptBlock( this.Page.GetType(), "alert", "alert('Record Updated Successfully');", true); // ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('Record Updated Successfully');", true); } else { this.ClientScript.RegisterClientScriptBlock( this.Page.GetType(), "alert", "alert('Record Updated Successfully');", true); // ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('Record Save Successfully');", true); }
please refer to the link for details:
ScriptManager.RegisterClientScriptBlock Method
http://msdn.microsoft.com/en-us/library/bb350750(v=vs.110).aspx
Hope it helps you.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, February 19, 2014 1:54 AM -
User546321960 posted
Hello,Happy
Thanks for your support
I am using as per suggestion code, but not working yet. Not display any message on Save Button Click Event
this.ClientScript.RegisterClientScriptBlock( this.Page.GetType(), "alert", "alert('Record Updated Successfully');", true);
Please give me any other solution ?
Thanks
APWednesday, February 19, 2014 11:46 PM