Usercontrol with ajax update panel causes null reference exception.

Discussion in 'ASP .Net' started by Wayne Brantley, Mar 14, 2007.

  1. Wayne Brantley, Mar 14, 2007
    #1
    1. Advertising

  2. Hi Wayne,

    I cannot seem to reproduce the issue you mentioned on asp.net forum. I've
    created following simple WebUserControl and it's working fine on a WebForm:

    <%@ Control Language="C#" ClassName="WebUserControl" %>

    <script runat="server">

    protected void Button1_Click(object sender, EventArgs e)
    {
    // Label1.Text = DateTime.Now.ToString();
    LabelText = DateTime.Now.ToString();
    }

    public string LabelText
    {
    get { return Label1.Text; }
    set { Label1.Text = value; }
    }

    </script>


    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
    Text="Button" />
    </ContentTemplate>
    </asp:UpdatePanel>


    Please note that I'm not adding a ScriptManager onto the UserControl since
    only one ScriptManager instance can exist on a WebForm; therefore the
    ScriptManager will always be added to the WebForm.

    I've also tried to use a MasterPage and still not able to reproduce it.

    Would you please post a complete code listing that could reproduce the
    issue? Thanks.


    Sincerely,
    Walter Wang (, remove 'online.')
    Microsoft Online Community Support

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications. If you are using Outlook Express, please make sure you clear the
    check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
    promptly.

    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.
    ==================================================

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Walter Wang [MSFT], Mar 14, 2007
    #2
    1. Advertising

  3. Hi Wayne,

    Since a web page can contain only one ScriptManager control (either
    directly on the page itself or indirectly inside a nested or parent
    component), you can use ScriptManagerProxy
    (http://ajax.asp.net/docs/mref/T_System_Web_UI_ScriptManagerProxy.aspx)
    when you're using UpdatePanel on a content page or a web user control.


    Regards,
    Walter Wang (, remove 'online.')
    Microsoft Online Community Support

    ==================================================
    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.
    ==================================================

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Walter Wang [MSFT], Mar 16, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?cm9kY2hhcg==?=

    datalist and ajax update panel

    =?Utf-8?B?cm9kY2hhcg==?=, Oct 2, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    720
    =?Utf-8?B?cm9kY2hhcg==?=
    Oct 2, 2006
  2. =?Utf-8?B?cm9kY2hhcg==?=

    ajax update panel trigger

    =?Utf-8?B?cm9kY2hhcg==?=, Oct 6, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    521
    =?Utf-8?B?cm9kY2hhcg==?=
    Oct 7, 2006
  3. GaryDean

    AJAX Update Panel w I.E.7 Problem

    GaryDean, Dec 4, 2006, in forum: ASP .Net
    Replies:
    10
    Views:
    5,018
    Steven Cheng[MSFT]
    Dec 12, 2006
  4. =?Utf-8?B?Qw==?=

    ASP.NET Ajax Update Panel in ContentPlaceHolder

    =?Utf-8?B?Qw==?=, Feb 12, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    1,303
    =?Utf-8?B?Qw==?=
    Feb 12, 2007
  5. =?Utf-8?B?TGlhbQ==?=

    AJAX update panel causes full page post back

    =?Utf-8?B?TGlhbQ==?=, Oct 15, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    734
    =?Utf-8?B?TGlhbQ==?=
    Oct 15, 2007
Loading...

Share This Page