2

I have developed a small application in SharePoint. I am using custom application page and load .ascx Control over that page under Page_Load() method. In .ascx Control, I have created a small form with text boxes and a button Control. under this button click event, I want to change the text property of label like: lblConfirmation.Text = "Confirmation is OK"; but it did not change the text. It shows nothing because i set text property empty in label Control.

<asp:Label ID="lblConfirmation" runat="server" Text="" ></asp:Label>

Any Idea, what is wrong ?

1
  • Can you please share your PageLoad event code...? Dec 12, 2012 at 18:48

1 Answer 1

1

Probably you need to check if it's a real postback or a first page load in your Page_Load() method... like this

if(!IsPostback)
{
    // code to only run at first page load here 
}

Otherwise you will initiate the label.Text to an empty string on each postback of the page and the page will be (more or less) static.

1
  • Custon event in control : EventHandler SubmitHandler = (EventHandler)Events[EventSubmitKey]; SubmitHandler(this, e);
    – Kiquenet
    Jul 28, 2021 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.