Click here to Skip to main content
15,895,781 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there any possibility to set textbox value from database based on selecting ajax cascading drop down without auto postback?if possible how?
Posted
Comments
Sinisa Hajnal 30-Oct-15 3:29am    
If you don't want to go to server, you have to have the value you need (based on the dropdown) somewhere on the page. Either add it to the dropdown itself or have a bag of values on the page and select based on that.

Otherwise, you have to take the dropdown value and do another ajax call. By definition, ajax calls are NOT postbacks :) Good luck

yes, use

<asp:updatepanel id="UpdatePanel1" runat="server" xmlns:asp="#unknown">
<contenttemplate>
<asp:textbox id="txtID" runat="server">

<triggers> <asp:asyncpostbacktrigger controlid="yourdropdownlistid" eventname="SelectedIndexChanged">



in code behind

protected void yourdropdownlistid_SelectedIndexChanged(object sender, EventArgs e)
{
//get Data from database and assign the value to textbox
}
 
Share this answer
 
Comments
User-11630313 30-Oct-15 3:41am    
hi..thanks for replay...i tried what your posted but some errors occured like
Error 3type 'System.Web.UI.UpdatePanel' does not have a public property named 'TextBox' and
Maddy Mc 30-Oct-15 3:45am    
can i see you code segment
User-11630313 30-Oct-15 3:47am    
<tr> <td class="caption">
Chit Period Code:
<asp:DropDownList ID="ddlPeriodCode" runat="server" CssClass="userentry">
<cc1:CascadingDropDown ID="cdlChitPeriod" TargetControlID="ddlPeriodCode" PromptText="Select Chit Period"
ServicePath="~/CasCadingDropDown.asmx" ServiceMethod="GetChitPeriodCode" runat="server"
Category="PrdCode" LoadingText="Loading..." UseContextKey="true" />
</td></tr>
<tr>

<td class="caption">
Maximum Discount:
<asp:updatepanel id="UpdatePanel1" runat="server">
<asp:TextBox ID="txtMaxDiscount" runat="server" CssClass="userentry">
<asp:asyncpostbacktrigger controlid="ddlPeriodCode" eventname="ddlPeriodCode_SelectedIndexChanged" />

</td>
</tr>
Maddy Mc 30-Oct-15 3:52am    
ur using TagPrefix="cc1" so change <asp:updatepanel id="UpdatePanel1" runat="server"> to <cc1:updatepanel id="UpdatePanel1" runat="server">
Maddy Mc 30-Oct-15 3:54am    
<cc1:UpdatePanel ID="UpdatePanel1" runat="server">
<contenttemplate>
<asp:TextBox ID="txtMaxDiscount" runat="server" CssClass="userentry">

<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddlMutationType" EventName="SelectedIndexChanged" />
</Triggers>
XML
<cc1:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <asp:TextBox ID="txtMaxDiscount" runat="server" CssClass="userentry"></asp:TextBox>
                            </ContentTemplate>
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="ddlMutationType" EventName="SelectedIndexChanged" />
                            </Triggers>
                        </cc1:UpdatePanel>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900