gri中显示的文本框和下拉列表数据 [英] Data of textboxes and dropdownlist display in gri

查看:83
本文介绍了gri中显示的文本框和下拉列表数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下午好,


我的.aspx文件如下所示.

Good Afternoon ,


My .aspx file is given below.

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>
         <div class="ContentClass">
         <asp:TabContainer ID="AssetTransactionTab" runat="server" ActiveTabIndex="0" CssClass="Tab"   Width="794px" Height="290px">
         <asp:TabPanel ID="NewTransaction"  runat="server"  HeaderText="New Transaction" >
         <ContentTemplate>


<asp:UpdatePanel ID="DetailUpdatePanel"  runat="server">
             <ContentTemplate>
            <table align="center" style="width: 666px">
             <tr>
             <td class="lableColumn"><asp:Label ID="lblAssetID" runat="server" Text="Asset ID:"></asp:Label> </td>
             <td><asp:DropDownList ID="ddlAssetID" runat="server"

                     DataSourceID="ddlAssetIDSource" DataTextField="AssetDescription"

                     DataValueField="AssetID" CssClass="ddlstyle"></asp:DropDownList>
                 <asp:SqlDataSource ID="ddlAssetIDSource" runat="server"

                     ConnectionString="<%$ ConnectionStrings:DeemahAssetConnectionString %>"

                     SelectCommand="GetAssetDropDown" SelectCommandType="StoredProcedure">
                 </asp:SqlDataSource>
                 </td>
                   <td class="lableColumn"><asp:Label ID="lblEmployeeID" runat="server" Text="Employee ID:"></asp:Label> </td>
              <td><asp:DropDownList ID="ddlEmployeeID" runat="server"

                      DataSourceID="ddlEmployeeIDSource" DataTextField="EmployeeName"

                      DataValueField="EmployeeID" CssClass="ddlstyle" Width="200px"></asp:DropDownList>
                  <asp:SqlDataSource ID="ddlEmployeeIDSource" runat="server"

                      ConnectionString="<%$ ConnectionStrings:DeemahAssetConnectionString %>"

                      SelectCommand="GetEmployeeDropDown" SelectCommandType="StoredProcedure">
                  </asp:SqlDataSource>
                 </td>
             </tr>
             <tr>
              <td class="lableColumn"><asp:Label ID="lblSupplierID" runat="server" Text="Supplier ID:"></asp:Label></td>
             <td><asp:DropDownList ID="ddlSupplierID" runat="server"

                     DataSourceID="ddlSupplierIDSource" DataTextField="VendorName"

                     DataValueField="VendorID" CssClass="ddlstyle"></asp:DropDownList>
                 <asp:SqlDataSource ID="ddlSupplierIDSource" runat="server"

                     ConnectionString="<%$ ConnectionStrings:DeemahAssetConnectionString %>"

                     SelectCommand="GetVendorDropDown" SelectCommandType="StoredProcedure">
                 </asp:SqlDataSource>
                 </td>
                 <td class="lableColumn"><asp:Label ID="lblIssuedReceivedDate" runat="server" Text="Issued/Received Date:"></asp:Label></td>
             <td><asp:TextBox ID="txtIssuedReceivedDate" runat="server" CssClass="txtstyle"></asp:TextBox>
              <asp:ImageButton ID="imgIssuedReceivedDate" runat="server" ImageUrl="~/Images/btn_calicon.gif" />
                 <asp:CalendarExtender ID="calIssuedReceivedDate" runat="server" TargetControlID="txtIssuedReceivedDate" PopupButtonID="imgIssuedReceivedDate">
                 </asp:CalendarExtender></td>
             </tr>
              <tr>
               <td class="lableColumn"><asp:Label ID="lblLocationID" runat="server" Text="Location ID:"></asp:Label></td>
             <td><asp:DropDownList ID="ddlLocationID" runat="server"

                     DataSourceID="ddlLocationSource" DataTextField="LocationName"

                     DataValueField="LocationID" CssClass="ddlstyle"></asp:DropDownList>
                 <asp:SqlDataSource ID="ddlLocationSource" runat="server"

                     ConnectionString="<%$ ConnectionStrings:DeemahAssetConnectionString %>"

                     SelectCommand="GetLocationDropDown" SelectCommandType="StoredProcedure">
                 </asp:SqlDataSource>
                 </td>
                 <td><asp:Button ID="btnAdd" runat="server" Text="ADD" CssClass="Btn"

                         onclick="btnAdd_Click"></asp:Button></td>
                 </tr>
             </table>
            </ContentTemplate>
             </asp:UpdatePanel>
             <div>
             <asp:UpdatePanel ID="GridUpdatePanel" runat="server">
             <ContentTemplate>
             <asp:GridView ID="GriDisplay" runat="server" AutoGenerateColumns="False">
             <Columns>
             <asp:TemplateField  HeaderText="Asset">
             </asp:TemplateField>
             <asp:TemplateField  HeaderText="Location">
             </asp:TemplateField>
             </Columns>
             </asp:GridView>
             </ContentTemplate>
             </asp:UpdatePanel>
             </div>
         </div>
         </ContentTemplate>
         </asp:TabPanel>
         </asp:TabContainer>
         </div>
</asp:Content>



and my aspx.cs file is given below.




and my aspx.cs file is given below.


protected void btnAdd_Click(object sender, EventArgs e)
  {
      ArrayList arr = new ArrayList();
      arr.Add(int.Parse(ddlAssetID.SelectedValue).ToString());
      arr.Add(int.Parse(ddlEmployeeID.SelectedValue).ToString());
      GriDisplay.DataSource = arr;
      GriDisplay.DataBind();
  }



i need when i click "btnAdd" then selected dropdownlist value and textbox value bind with gridview ,means if i select dropdownlist and textbox value and when i click "btnAdd" then one record display in gridview,when i click again "btnAdd" then another record insert in gridview on base of selected value of dropdown and textboxes.

if you have any other ideato do this work then please assist me.

thanks



i need when i click "btnAdd" then selected dropdownlist value and textbox value bind with gridview ,means if i select dropdownlist and textbox value and when i click "btnAdd" then one record display in gridview,when i click again "btnAdd" then another record insert in gridview on base of selected value of dropdown and textboxes.

if you have any other ideato do this work then please assist me.

thanks

推荐答案

ConnectionStrings:DeemahAssetConnectionString %>" SelectCommand="GetAssetDropDown" SelectCommandType="StoredProcedure"> < /asp:SqlDataSource > < /td > <td class="lableColumn"><asp:Label ID="lblEmployeeID" runat="server" Text="Employee ID:"></asp:Label> </td> <td><asp:DropDownList ID="ddlEmployeeID" runat="server" DataSourceID="ddlEmployeeIDSource" DataTextField="EmployeeName" DataValueField="EmployeeID" CssClass="ddlstyle" Width="200px"></asp:DropDownList> <asp:SqlDataSource ID="ddlEmployeeIDSource" runat="server" ConnectionString="<%
ConnectionStrings:DeemahAssetConnectionString %>" SelectCommand="GetAssetDropDown" SelectCommandType="StoredProcedure"> </asp:SqlDataSource> </td> <td class="lableColumn"><asp:Label ID="lblEmployeeID" runat="server" Text="Employee ID:"></asp:Label> </td> <td><asp:DropDownList ID="ddlEmployeeID" runat="server" DataSourceID="ddlEmployeeIDSource" DataTextField="EmployeeName" DataValueField="EmployeeID" CssClass="ddlstyle" Width="200px"></asp:DropDownList> <asp:SqlDataSource ID="ddlEmployeeIDSource" runat="server" ConnectionString="<%


ConnectionStrings:DeemahAssetConnectionString %>" SelectCommand="GetEmployeeDropDown" SelectCommandType="StoredProcedure"> < /asp:SqlDataSource > < /td > < /tr > < tr > <td class="lableColumn"><asp:Label ID="lblSupplierID" runat="server" Text="Supplier ID:"></asp:Label></td> <td><asp:DropDownList ID="ddlSupplierID" runat="server" DataSourceID="ddlSupplierIDSource" DataTextField="VendorName" DataValueField="VendorID" CssClass="ddlstyle"></asp:DropDownList> <asp:SqlDataSource ID="ddlSupplierIDSource" runat="server" ConnectionString="<%
ConnectionStrings:DeemahAssetConnectionString %>" SelectCommand="GetEmployeeDropDown" SelectCommandType="StoredProcedure"> </asp:SqlDataSource> </td> </tr> <tr> <td class="lableColumn"><asp:Label ID="lblSupplierID" runat="server" Text="Supplier ID:"></asp:Label></td> <td><asp:DropDownList ID="ddlSupplierID" runat="server" DataSourceID="ddlSupplierIDSource" DataTextField="VendorName" DataValueField="VendorID" CssClass="ddlstyle"></asp:DropDownList> <asp:SqlDataSource ID="ddlSupplierIDSource" runat="server" ConnectionString="<%


ConnectionStrings:DeemahAssetConnectionString %>" SelectCommand="GetVendorDropDown" SelectCommandType="StoredProcedure"> < /asp:SqlDataSource > < /td > <td class="lableColumn"><asp:Label ID="lblIssuedReceivedDate" runat="server" Text="Issued/Received Date:"></asp:Label></td> <td><asp:TextBox ID="txtIssuedReceivedDate" runat="server" CssClass="txtstyle"></asp:TextBox> <asp:ImageButton ID="imgIssuedReceivedDate" runat="server" ImageUrl="~/Images/btn_calicon.gif" /> <asp:CalendarExtender ID="calIssuedReceivedDate" runat="server" TargetControlID="txtIssuedReceivedDate" PopupButtonID="imgIssuedReceivedDate"> </asp:CalendarExtender></td> < /tr > < tr > <td class="lableColumn"><asp:Label ID="lblLocationID" runat="server" Text="Location ID:"></asp:Label></td> <td><asp:DropDownList ID="ddlLocationID" runat="server" DataSourceID="ddlLocationSource" DataTextField="LocationName" DataValueField="LocationID" CssClass="ddlstyle"></asp:DropDownList> <asp:SqlDataSource ID="ddlLocationSource" runat="server" ConnectionString="<%
ConnectionStrings:DeemahAssetConnectionString %>" SelectCommand="GetVendorDropDown" SelectCommandType="StoredProcedure"> </asp:SqlDataSource> </td> <td class="lableColumn"><asp:Label ID="lblIssuedReceivedDate" runat="server" Text="Issued/Received Date:"></asp:Label></td> <td><asp:TextBox ID="txtIssuedReceivedDate" runat="server" CssClass="txtstyle"></asp:TextBox> <asp:ImageButton ID="imgIssuedReceivedDate" runat="server" ImageUrl="~/Images/btn_calicon.gif" /> <asp:CalendarExtender ID="calIssuedReceivedDate" runat="server" TargetControlID="txtIssuedReceivedDate" PopupButtonID="imgIssuedReceivedDate"> </asp:CalendarExtender></td> </tr> <tr> <td class="lableColumn"><asp:Label ID="lblLocationID" runat="server" Text="Location ID:"></asp:Label></td> <td><asp:DropDownList ID="ddlLocationID" runat="server" DataSourceID="ddlLocationSource" DataTextField="LocationName" DataValueField="LocationID" CssClass="ddlstyle"></asp:DropDownList> <asp:SqlDataSource ID="ddlLocationSource" runat="server" ConnectionString="<%


这篇关于gri中显示的文本框和下拉列表数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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