0
안녕하세요, 제가 게시 한 제목입니다. 정말, TextBox에서 자동으로 표시를 변경할 수있는 DDL에서 결과를 얻는 방법을 알아야합니다. 우리의 각 품목에는 2 개 이상 크기가 있고 때때로 당신은 다른 크기를 클릭 할 때 가격이 다를 것이다. 어떻게이 기능을 구현할 수 있습니까?DropDownList 선택에서 TextBox의 데이터 표시를 변경하는 방법은 무엇입니까?
도움이 되었으면 좋겠습니다.
Details.aspx : 여기
내 샘플 코드입니다<asp:TemplateField SortExpression="Size" ItemStyle-Wrap="True" ItemStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Bottom" HeaderStyle-Wrap="False" HeaderText="Options">
<ItemTemplate>
Size:<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SizeSource" AutoPostBack="true" DataTextField="Size" DataValueField="Size" Height="22px" Width="60px">
</asp:DropDownList>
Qty:<asp:TextBox ID="TextBox2" runat="server" Height="16px" Width="30px" Text="<%# 1 %>"></asp:TextBox>
<br />
Price(USD):
<asp:TextBox runat="server" DataSourceID="SizeSource" SortExpression="Price" DataFormatString="{0}" ID="PriceList" Width="50px" Height="16px" ValidationGroup="Price" AutoPostBack="True" />
<asp:SqlDataSource ID="SizeSource" runat="server" ConnectionString="<%$ ConnectionStrings:LIFEbabySAP %>" SelectCommand="SELECT left(T0.ItemCode,8) as Image, left(T0.ItemCode,8) as Code, T0.U_ItemName as Name, T0.U_Size as Size, T0.U_Colour as Color,case T1.Onhand when 0 then 'Out of Stock' else 'In Stock' end as Availability, T0.UserText as Description, CAST(T2.Price as Int)as Price FROM OITM T0 inner join oitw T1 on T0.ItemCode = T1.Itemcode inner join itm1 T2 on T0.ItemCode = T2.ItemCode WHERE (left(T0.ItemCode,8) = @Image) and T0.U_USE = 'Y' and T1.Onhand != 0 and T1.whscode ='BAW' and T2.PriceList = 10">
<SelectParameters>
<asp:QueryStringParameter Name="Image" QueryStringField="product" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</ItemTemplate>
<HeaderStyle Wrap="False"></HeaderStyle>
<ItemStyle HorizontalAlign="Left" VerticalAlign="Bottom" Wrap="True"></ItemStyle>
</asp:TemplateField>
Catalog.aspx.cs 코드 숨김 (C 번호) :
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
string Size = Request.QueryString["Price"];
if (Size != null)
{
ddlCategory.SelectedValue = Size;
}
}
ItemsGet();
}
protected void CatalogList_SelectedIndexChanged(object sender, EventArgs e)
{
string Image = CatalogList.SelectedValue.ToString().Trim();
string catid = ddlCategory.SelectedValue;
Response.Redirect("Details.aspx?product="
+ Image
+ "&Price="
+ catid);
}