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

i am using web farm solution and i have implemented few custom properties and my question is, is there a way i can enabled AJAX? when the user enter the bad name i validate in the prop and display error and its all working fine but it postback (repainting) the page.

private string _listName;
        [WebBrowsable(true), WebDisplayName("List Name"),   WebDescription("Enter ~ Separated List Name to Show Data Here.."),   Personalizable(PersonalizationScope.Shared),   System.ComponentModel.Category("Settings"),   System.ComponentModel.DefaultValue("")]
        public string ListName
        {
            get { return _listName; }
            set
            {
                if (string.IsNullOrEmpty(_listName))
                    throw new WebPartPageUserException("Please enter atleast one List Name here...");
                else
                    _listName = value;
            }
        }
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Are you just wanting the webpart to repaint or some other part of the page?

If it's just your own webpart, then you can do one of two things.

  1. Add an update panel to your webpart and then put all of your controls in the update panel. This is probably the easiest but does have a lot of overhead and there is some complexity if you have multiple ones on the page.

  2. You could have your webpart implement ICallbackEventHandler. From here you can do an ajax call and that call will return a string. Then on the client side in JavaScript, you take that string that is returned and use it to update the html in your webpart using the dom. This solution is harder to impliment, but has less overhead.

share|improve this answer
    
have you done the option #1 and do you have sample code for that? –  Abu Hamzah Sep 2 '11 at 18:09
    
I have, unfortunately the code is too much to post here. A quick google search revealed a blog which shows you how to implement an update panel in a SharePoint webpart: jamestsai.net/Blog/post/… –  Steve Lineberry Sep 2 '11 at 18:26
add comment

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.