Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 15th, 2008, 09:37 AM
Registered User
 
Join Date: Oct 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem while using Ajax implemented user control

Hi guys,

I am using Ajax in a user control. My user control contains one textbox and one dropdownlist. The dropdownlist is filled on the basis of text written in the textbox. This is running fine with atlas and my code is


<asp:Panel ID="speedSearchPanel" runat="server">
    <ajax:ScriptManager ID="speedSearchScriptManager" runat="server" OnAsyncPostBackError="SpeedSearchScriptManagerAsyn cPostBackError" />
    <ajax:UpdatePanel ChildrenAsTriggers="false" RenderMode="inline" ID="speedSearchUpdatePanel" UpdateMode="Conditional"
        runat="server">
        <ContentTemplate>
            <asp:TextBox ID="searchTextBox" runat="server" CssClass="MediumTextBox" AutoPostBack="true"
                OnTextChanged="SearchTextBoxTextChanged" Width="100px" />
            <asp:DropDownList ID="searchResultDropDownList" CssClass="DropDownList" runat="server"
                Width="220px" />
        </ContentTemplate>
        <Triggers>
            <ajax:AsyncPostBackTrigger ControlID="searchTextBox" EventName="TextChanged" />
        </Triggers>
    </ajax:UpdatePanel>
</asp:Panel>


Now, I have to use this control on a .aspx page that contains textboxes that are to be filled when selected index of the dropdown is changed.

To Implement this I modified the above code as below

<asp:Panel ID="speedSearchPanel" runat="server">
    <ajax:ScriptManager ID="speedSearchScriptManager" runat="server" OnAsyncPostBackError="SpeedSearchScriptManagerAsyn cPostBackError" />
    <ajax:UpdatePanel ChildrenAsTriggers="false" RenderMode="inline" ID="speedSearchUpdatePanel" UpdateMode="Conditional" runat="server">
        <ContentTemplate>
            <asp:TextBox ID="searchTextBox" runat="server" CssClass="MediumTextBox" AutoPostBack="true" OnTextChanged="SearchTextBoxTextChanged" Width="100px" />
            <asp:DropDownList ID="searchResultDropDownList" CssClass="DropDownList" runat="server" OnSelectedIndexChanged="GetData" Width="220px" />
        </ContentTemplate>
        <Triggers>
            <ajax:AsyncPostBackTrigger ControlID="searchTextBox" EventName="TextChanged"/>
            <ajax:AsyncPostBackTrigger ControlID="searchResultDropDownList" EventName="GetData" />
        </Triggers>
    </ajax:UpdatePanel>
</asp:Panel>

But this is not solving my problem.

And when I used PostBackTrigger for searchResultDropDownList, it worked but the page refreshed.

I want the textboxes of .aspx page to be filled on the change event of searchResultDropDownList with the data it is fetching from database.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem while using User Control vivekshah ASP.NET 1.0 and 1.1 Professional 0 August 7th, 2008 02:46 AM
User control accessing problem tgnishant ASP.NET 2.0 Professional 1 May 3rd, 2007 08:52 AM
Much much problem with the User Control! daffodils ASP.NET 1.0 and 1.1 Basics 7 October 20th, 2006 10:46 AM
User Control Problem alyeng2000 ASP.NET 1.0 and 1.1 Basics 4 March 19th, 2004 11:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.