通过选择带有回发的级联下拉列表,从数据库设置文本框值 [英] Set textbox value from database by selecting cascading dropdown with out postback
本文介绍了通过选择带有回发的级联下拉列表,从数据库设置文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能根据选择ajax级联下拉而不自动回发来设置数据库中的文本框值?如果可能的话怎么办?
Is there any possibility to set textbox value from database based on selecting ajax cascading drop down without auto postback?if possible how?
推荐答案
是的,使用
< asp:updatepanel id =UpdatePanel1runat =serverxmlns:asp =#unknown>
< contenttemplate> ;
< asp:textbox id =txtIDrunat =server>
< triggers> < asp:asyncpostbacktrigger controlid =yourdropdownlistideventname =SelectedIndexChanged>
in代码背后
protected void yourdropdownlistid_SelectedIndexChanged(object sender,EventArgs e)
{
//获取数据来自数据库并将值分配给文本框
}
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
}
<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>
>
这篇关于通过选择带有回发的级联下拉列表,从数据库设置文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文