使用c#下拉TextBox中的选定值 [英] Dropdown Selected Value in TextBox using c#

查看:196
本文介绍了使用c#下拉TextBox中的选定值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在updatepanel和numaric文本框中的下拉列表位于更新面板之外

我的设计是



my dropdownlist in updatepanel and numaric textbox is outside the updatepanel
my designe is

<td style="width: 50%" align="left" valign="middle">                             
 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
  <ContentTemplate>
<asp:DropDownList ID="ddlVendorName" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlVendorName_SelectedIndexChanged">
<asp:ListItem Text="Select" Value="0"></asp:ListItem>
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
</td>




<td style="width: 50%">
<cc1:NumericTextBox ID="txtDiscount" runat="server" MaxLength="6"

TabIndex="1" AllowDecimal="True"></cc1:NumericTextBox>

< / td>



在页面中load我将数据绑定到下拉列表和

使用下拉选择值我从数据库获得折扣值并分配给数据集,从该数据集值分配到txtDiscount

在此ddlVendorName_SelectedIndexChanged事件我有ome代码如

protected void ddlVendorName_SelectedIndexChanged(

DataSet ds = new MI.DAL.InventoryPurchases()。GetVendorsPriceDetails(Convert.ToInt32(ddlVendorName.SelectedValue));

txtDeduction.Text = ds.Tables [0] .Rows [0] [0] .ToString();



该值即将到来,但它不是在浏览器的前端徘徊。



请帮助我....

</td>

In Page load I am Binding data to dropdownlist and
using dropdown selected value i am getting discount value from database and assign to dataset , from that dataset value assign to txtDiscount
in this ddlVendorName_SelectedIndexChanged event i have some code like
protected void ddlVendorName_SelectedIndexChanged(
DataSet ds = new MI.DAL.InventoryPurchases().GetVendorsPriceDetails(Convert.ToInt32(ddlVendorName.SelectedValue));
txtDeduction.Text = ds.Tables[0].Rows[0][0].ToString();

that value is coming but it is not sohwing at front end on browser .

pls help me ....

推荐答案

你已经将更新面板添加到您的td,它仅适用于它,并且当您显示代码时,您的文本框位于其他td上,因此ti不会在UI上更新。



请从您的td中删除您的更新面板,并在更新面板中添加整个表格,以便解决您的问题。



参考...



工作使用ASP.NET UpdatePanel中的jQuery [ ^ ]



http://www.asp.net/ajax/documentation/ live / overview / updatepaneloverview.aspx [ ^ ]



http: //ajax.net-tutorials.com/controls/updatepanel-control/ [ ^ ]
you have added your update panel to your td, it's work only for it, and as you shown your code, your textbox is on other td, so ti will not updated on UI.

please remove your update panel from your td, and add whole table inside your update panel, so your problem is solved.

Reference...

Working with jQuery within the ASP.NET UpdatePanel[^]

http://www.asp.net/ajax/documentation/live/overview/updatepaneloverview.aspx[^]

http://ajax.net-tutorials.com/controls/updatepanel-control/[^]


这篇关于使用c#下拉TextBox中的选定值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆