2009-05-07 36 views
0

こんにちは、私が投稿した主題です。私は本当に、TextBoxの表示を自動的に変更できるDDLから結果を得る方法を知る必要があります。私たちの各アイテムは複数のサイズを持っていますが、異なるサイズをクリックすると価格が異なることがあります。この機能を実装するにはどうすればよいですか?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> 
    &nbsp;&nbsp;&nbsp;&nbsp; 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); 
} 

答えて

0

することができますあなたはちょうどよりalittleを指定しますドロップダウンの値を取ってテキストボックスに入れますか?これはサーバーコントロール(つまり、グリッドビュー、データリストなど)になりますか?

関連する問題