Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Edit : actually, my current task is focused on the refactor of a webpart, but the question is in fact a general question : what are guidelines for "cool" SP UI. /Edit

I have to maintain a set of webparts that have been written in old asp.net fashion way.

  • one web part that insert data : a custom asp.net form that create splistitems
  • several webparts that show this data using custom SPQuery and custom user control to show this data (in the page_load event, controls are populated)

The whole thing works, but there are a lot of drawbacks :

  • if I insert data with the 1st webpart, the other webparts are not refreshed (because of the postback check in the page_load). I solved the problem using a redirect to current page
  • if I hit F5, the data is submitted again
  • it use postback and the user feel is lower than a nice rich ajax app

What are the first steps to refactor this webparts to add a bit of responsivness interactivity ?

When I use OOB webparts, there is lot of AJAX to refresh dynamically data. How can I properly (and simply) integrate with/reuse this UI framework ?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

I'd suggest you start learning and using the Sharepoint 2010 Client OM (Client Object Model).

You can read more about it here : http://blogs.technet.com/b/speschka/archive/2009/11/01/using-the-sharepoint-2010-client-object-model-part-1.aspx

Also, if you write your asp.net code properly, you shouldn't have issues data being submitted again.

One example of this, is that you should never submit data to any system in the Page_Load of a control/page. Always use the Event_Fire Methods for doing the actual post.

Example :

protected void Page_Load(object sender, EventArgs e)
{
    if (this.IsPostBack)
    {
        //DO POSTBACK HANDLING HERE. USER CLICKED A BUTTON OR INTERACTED WITH A CONTROL WHICH CAUSED A POSTBACK
    }
    else
    {
        //DO NORMAL HANDLING (NOTHING WAS CLICKED OR SUBMITTED HERE.. MOST LIKELY, THE USER WAS REDIRECT FROM ANOTHER PAGE AND THIS IS THE FIRST LOAD OF THE PAGE
    }
}

protected void Button1_Click(object sender, EventArgs e)
{
    SubmitData();
}
share|improve this answer
    
I see the client OM as a way to read/write data from the host SP, right? It's of course a first step to walk. I'm also especially wondering how to structurate my webpart to let them communicate together. In fact, like OOB web parts can query the refresh of others, I'd like to said "a item of MyList has been inserted, refresh if need". How to do that ? –  Steve B Jul 6 '11 at 12:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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