Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 428721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:42:15+00:00 2026-05-12T19:42:15+00:00

In a module i have a sub that create modalpopup and show result of

  • 0

In a module i have a sub that create modalpopup and show result of action..I dont wanna drop & drag modalpopup extender and make html complex therefore i do that in code-behind.I wonder that Can i cache my panel and then get it from cache?It takes time to crate these panels.Or do u have recommodations to improve performance of this Sub?I use Script Combining,JS minify and Css minify.My sub’s code is here.

Public Sub Raise_Alarm(ByVal p_Page As Page, ByRef p_AssignedButton As System.Web.UI.WebControls.Button, ByVal p_Message As String, Optional ByVal p_Type As MessageType = MessageType.Success)

    Dim placeHolder As PlaceHolder = p_Page.FindControl("plcMsg")

    Dim lblStatus As System.Web.UI.WebControls.Label
    lblStatus = p_Page.FindControl("lblStatus")
    lblStatus.Width = Unit.Percentage(100)
    lblStatus.Font.Name = "verdana"
    lblStatus.Font.Size = System.Web.UI.WebControls.FontUnit.XSmall


    'Create Modalpopup extender
    Dim mdlMessage As New AjaxControlToolkit.ModalPopupExtender

    'Create Divs
    Dim pnlMessage As New System.Web.UI.WebControls.Panel
    Dim pnlFrame As New System.Web.UI.WebControls.Panel
    Dim pnlContainer As New System.Web.UI.WebControls.Panel
    Dim pnlHeader As New System.Web.UI.WebControls.Panel
    Dim pnlMsg As New System.Web.UI.WebControls.Panel
    Dim pnlBody As New System.Web.UI.WebControls.Panel
    Dim pnlFooter As New System.Web.UI.WebControls.Panel
    Dim pnlRight As New System.Web.UI.WebControls.Panel
    '*******

    'Create Ok Buttons

    Dim btnOk As New System.Web.UI.WebControls.Button

    'Create Message Label

    Dim lblMessage As New System.Web.UI.WebControls.Label
    Dim myheader As New System.Web.UI.WebControls.Label
    'Assign Properties 

    pnlMessage.ID = "pnlMessage"
    pnlMessage.CssClass = "modal-dialog"
    pnlMessage.Style.Add("display", "none")

    pnlFrame.ID = "pnlframe"
    pnlFrame.CssClass = "frame"
    pnlContainer.ID = "container"
    pnlContainer.CssClass = "container"
    pnlHeader.ID = "header"
    pnlHeader.CssClass = "header"

    myheader.ID = "headerlabel"
    myheader.Text = "Warning"

    pnlMsg.ID = "msg"
    pnlMsg.CssClass = "msg"

    pnlBody.ID = "body"
    pnlBody.CssClass = "body"

    pnlFooter.ID = "footer"
    pnlFooter.CssClass = "footer"

    pnlRight.ID = "right"
    pnlRight.CssClass = "right"

    btnOk.ID = "btnOk"
    btnOk.Width = Unit.Pixel(50)
    btnOk.Text = "Ok"
    btnOk.CssClass = "but"      
    btnOk.OnClientClick = "Dispose()"



    lblMessage.ID = "lblMessage"
    lblMessage.Text = p_Message
    lblMessage.CssClass = "body"

    If p_Type = MessageType.Success Then

        lblStatus.ForeColor = System.Drawing.Color.Blue
        lblStatus.Text = p_Message
        lblStatus.Visible = True

    ElseIf p_Type = MessageType.Error Then

        lblStatus.ForeColor = System.Drawing.Color.Red

    End If


    pnlRight.Controls.Add(btnOk)
    pnlFooter.Controls.Add(pnlRight)
    pnlBody.Controls.Add(lblMessage)
    pnlBody.Controls.Add(pnlFooter)
    pnlMsg.Controls.Add(myheader)
    pnlHeader.Controls.Add(pnlMsg)
    pnlContainer.Controls.Add(pnlHeader)
    pnlContainer.Controls.Add(pnlBody)
    pnlFrame.Controls.Add(pnlContainer)
    pnlMessage.Controls.Add(pnlFrame)


    With mdlMessage


        .TargetControlID = p_AssigedButton.ID
        .PopupControlID = pnlMessage.ID
        .ID = "mdlMessage"
        .BackgroundCssClass = "modalBackground"
        .OkControlID = btnOk.ID
        .Page = p_Page

    End With

    placeHolder.Controls.Add(pnlMessage)
    placeHolder.Controls.Add(mdlMessage)
    mdlMessage.Show()
End Sub  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T19:42:15+00:00Added an answer on May 12, 2026 at 7:42 pm

    Have you measured the performance of this sub?

    We looked at this once and found that even 1000’s of create objects were still only a few nano seconds.

    If you want to cache something it must be serializable. For that to give you an improvement it must take less time to deserialize, than what it takes to create a new fresh object.

    It does not look like you are getting any values from a database, so I do not think that you can optimize this code with caching.

    EDIT

    There are a couple of other reasons not to do the caching:

    • It complicates your program, you need to check if a value is in cache before you can use it.
    • There are possibilities for introducing errors. Take for example lblStatus, this changes value depending on the parameters. If you just read it from the cache you could get one that does not match your parameters.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Typically I create a plugin when I have a module that I know I'm
I have a multi-module maven project with an installer sub-project. The installer will be
I have a module that sends an email to a specified email address but
I'm using a logging module that can have reporting enabled/disabled at runtime. Calls generally
I have a module in the parent directory of my script and I would
i have a module (a single .py file, actually), with a class called HashedDir.
Background: I have a module which declares a number of instance methods module UsefulThings
So I have a module in flex in which I add a custom component.
It appears the Python signal module doesn't have anything similar to the sighold and
I'm developing a Linux driver loadable module and I have to use another device

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.