Click here to Skip to main content
15,074,483 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi everybody... I'm a beginner at asp.net webform, Can you please help me fix my problem? i have dx:ASPxGridView contain of 4 Column "productId","ProductName","Brand",and "Unit". I can get the value for 3 first column, but I need to get the item text for the "Unit" column depend on the productId Combobox column which contains 3 columns "ProductId, ProductNam, Brand". after Combobox changing value.

thank.....

What I have tried:

JavaScript
function OnClick(s, e) {
             var item = listBox.GetSelectedItem();
             memo.SetText(item.GetColumnText(2));
             memo4.SetText(item.GetColumnText(0));
            proId.SetText(item.GetColumnText(0));
            memo2.SetText(item.GetColumnText(1));
            setTimeout(function () { grid.FocusEditor(3); }, 1);

         }

ASP.NET

 <dx:ASPxGridView ID="grid" runat="server" AutoGenerateColumns="False"  ClientInstanceName="grid"  OnCellEditorInitialize="grid_CellEditorInitialize" RightToLeft="True" Width="1293px" Theme="Metropolis" >
        <SettingsEditing Mode="Inline">
        </SettingsEditing>
        <Settings ShowFilterRow="True" />
               <SettingsBehavior AllowSelectSingleRowOnly="true" AllowSelectByRowClick="true" />
<SettingsCommandButton>
<ShowAdaptiveDetailButton ButtonType="Image"></ShowAdaptiveDetailButton>

<HideAdaptiveDetailButton ButtonType="Image"></HideAdaptiveDetailButton>
</SettingsCommandButton>
           <Columns>
                 <dx:GridViewDataComboBoxColumn Caption="ProductId" fieldName="ProId" Name="listBox" 
                Visible="true"  VisibleIndex="1">
                                 
                 <PropertiesComboBox  TextField="ProdName"  
                                   ValueField="ProductId"
                       DataSourceID="ProdNumDataSource"
                        ClientInstanceName="listBox">
                                
                          <Columns>
                        <dx:ListBoxColumn Caption="Product Id" FieldName="ProductId" Name="ColProductid"  />
                        <dx:ListBoxColumn Caption="Productc Name" FieldName="ProdName" Name="ColProductName" />
                        <dx:ListBoxColumn Caption="Brand" FieldName="BrandName"  />
                              
                         </Columns>
                         
                </PropertiesComboBox>

                <SettingsHeaderFilter>
                    <DateRangePickerSettings EditFormatString="" />
                </SettingsHeaderFilter>

            </dx:GridViewDataComboBoxColumn>

    <dx:GridViewDataTextColumn Caption="ProductName"  Visible="true" VisibleIndex="2" >

<SettingsHeaderFilter>
<DateRangePickerSettings EditFormatString=""></DateRangePickerSettings>
</SettingsHeaderFilter>

                        <PropertiesTextEdit ClientInstanceName="memo2"></PropertiesTextEdit>
              
                     </dx:GridViewDataTextColumn>
               <dx:GridViewDataTextColumn Caption="Brand" FieldName="brand" VisibleIndex="3">
                   <PropertiesTextEdit ClientInstanceName="memo">
                   </PropertiesTextEdit>
                   <SettingsHeaderFilter>
                       <DateRangePickerSettings EditFormatString="" />
                   </SettingsHeaderFilter>
               </dx:GridViewDataTextColumn>
               <dx:GridViewDataTextColumn Caption="Quantity" FieldName="quantity" VisibleIndex="4">
                  
                   <SettingsHeaderFilter>
                       <DateRangePickerSettings EditFormatString="" />
                   </SettingsHeaderFilter>
               </dx:GridViewDataTextColumn>
                 <dx:GridViewDataComboBoxColumn Caption="Unit" fieldName="Unit" name="memo4"
                Visible="true"  VisibleIndex="5">
                            
                 <PropertiesComboBox  TextField="UnitName" 
                                   ValueField="UnitId"
                       DataSourceID="UnitsDataSource"
                        ClientInstanceName="memo4">
                                 
                          <Columns>
                        <dx:ListBoxColumn Caption="UnitId Id" FieldName="UnitId"  Name="ColProductid" />
                        <dx:ListBoxColumn Caption="UnitName" FieldName="UnitName" Name="ColProductUnit" />
                    </Columns>
                         
                </PropertiesComboBox>

                <SettingsHeaderFilter>
                    <DateRangePickerSettings EditFormatString="" />
                </SettingsHeaderFilter>
  
            </dx:GridViewDataComboBoxColumn>
   </Columns>

       </dx:ASPxGridView>


SQL
<asp:SqlDataSource ID="ProdNumDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:phoenixConnectionString %>" SelectCommand="SELECT Products.ProductId, Products.ProdName, Brands.BrandName FROM Products  INNER JOIN Brands ON Products.Brand = Brands.BrandId where ProductId >0">
  </asp:SqlDataSource>
 <asp:SqlDataSource ID="invoice" runat="server" ConnectionString="<%$ ConnectionStrings:phoenixConnectionString %>" SelectCommand="SELECT Bills.AutoDocNum, BillDetails.ProId, BillDetails.quantity, BillDetails.ModuleQuantity, BillDetails.PriceCost, BillDetails.SecondUnit, BillDetails.Unit, BillDetails.module, BillDetails.brand FROM BillDetails INNER JOIN Bills ON Bills.DocNum = BillDetails.DocNum ">
</asp:SqlDataSource>
<asp:SqlDataSource ID="UnitsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:phoenixConnectionString %>" SelectCommand="SELECT Units.UnitName, ProductsDetail.UnitId, ProductsDetail.productId, ProductsDetail.ItemNo FROM Units INNER JOIN ProductsDetail ON Units.UnitId = ProductsDetail.UnitId">
</asp:SqlDataSource>
Posted

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