Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Ispostback in Web part

  Asked By: Meera    Date: Apr 29    Category: Sharepoint    Views: 4252

Is there any way we canimplement ispostback functionality in web part

Share: 

 

6 Answers Found

 
Answer #1    Answered By: Sarita Patel     Answered On: Apr 29

I would have thought that Page.IsPostback should work.

 
Answer #2    Answered By: Elias Cannon     Answered On: Apr 29

just use page.ispostback..................

 
Answer #3    Answered By: Kartik Athani     Answered On: Apr 29

Yes you can utilize the page.ispostback function but it does not work as
well as one might expect. Post backs are created when you add a Web Part
to a page - the page is posting back - but not necessarily the Web Part
(it is new). So if you are using isPostback to determine if the Web Part
needs initialization or not, you might get a true for the ispostback but
the Web Part never had a chance to configure.

 
Answer #4    Answered By: Ira Knox     Answered On: Apr 29

Just try this....
Create User control and implement IsPostBack in User
control and then include that User control in web
part.
Also try creating Application on different port and
then try....I m not sure about this...but u can try

 
Answer #5    Answered By: Clark Hill     Answered On: Sep 28

Unfortunately, you can't use the IsPostBack check like you would on a normal
control because the controls themselves can be added to the page as a result
of a postback.

The way to check for whether or not you need to initialize your controls is
by hooking up to the control's Load event (or the Page's) and then testing
whether or not the control already has data in it. If that makes sense. So
you would have:

private DropDownList cboStates;

protected override void CreateChildControls()
{
cboStates = new DropDownList();
cboStates.Load += new EventHandler(cboStates_Load);
Controls.Add(cboStates);
}

private void cboStates_Load(object sender, EventArgs args)
{
if (cboStates.Items.Count == 0)
{
// Initialize States Drop Down Here
}
}

"Dave" <microsoft.com> wrote in message
news:com...
I tried using it in the RenderWebPart method and it didn't recognize it.
properties that the user can setup. Once they select their options I want
the part to post back and allow me to save those properties and display the
content based on those properties.

 
Didn't find what you were looking for? Find more on Ispostback in Web part Or get search suggestion and latest updates.




Tagged: