1

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 ?

2
  • 1
    Can you please share your PageLoad event code...? Commented Dec 12, 2012 at 18:48
  • We need to see more code to answer this question, including the frontend code. Are you in an Update Panel here? Do you have anything on PageLoad or PostBack? Commented Aug 19 at 22:05

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); Commented Jul 28, 2021 at 11:32

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.