none
how to configure connection grid view and sqldatasource for filtering option.... RRS feed

  • Question

  •   .aspx code                                     

    <asp:GridView ID="gvProductList" runat="server" CellPadding="3" AutoGenerateColumns ="False" Width="1116px" OnSelectedIndexChanged="gvProductList_SelectedIndexChanged"  BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" DataSourceID="GridDataSource" OnRowCreated="gvProductList_RowCreated"  >
             <FooterStyle BackColor="White" ForeColor="#000066" />
             <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
             <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
             <RowStyle ForeColor="#000066" />
             <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
             <SortedAscendingCellStyle BackColor="#F1F1F1" />
             <SortedAscendingHeaderStyle BackColor="#007DBB" />
             <SortedDescendingCellStyle BackColor="#CAC9C9" />
             <SortedDescendingHeaderStyle BackColor="#00547E" />
              <AlternatingRowStyle />
             <Columns >
                            <asp:BoundField  DataField ="productcode" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" HeaderText="Product Code" ReadOnly="True" >
    <ItemStyle HorizontalAlign="Center" Width="10%"></ItemStyle>
                            </asp:BoundField>
                            <asp:BoundField  DataField ="ProductcatID" ItemStyle-HorizontalAlign="Center"  ItemStyle-Width="10%" HeaderText="Category" ReadOnly="True">
    <ItemStyle HorizontalAlign="Center" Width="10%"></ItemStyle>
                            </asp:BoundField>
                            <asp:BoundField DataField="barcode" ItemStyle-HorizontalAlign="Center"  ItemStyle-Width="10%" HeaderText="Bar Code Tag" ReadOnly="True">
    <ItemStyle HorizontalAlign="Center" Width="10%"></ItemStyle>
                            </asp:BoundField>
                            <asp:BoundField DataField="productDesc" ItemStyle-HorizontalAlign="Left"  ItemStyle-Width="20%" HeaderText="Product Description" ReadOnly="True">
    <ItemStyle HorizontalAlign="Left" Width="20%"></ItemStyle>
                            </asp:BoundField>                  
                            <asp:BoundField DataField="cost" ItemStyle-HorizontalAlign="Center"  ItemStyle-Width="10%"  HeaderText="Price" ReadOnly="True">
    <ItemStyle HorizontalAlign="Right" Width="10%"></ItemStyle>
                            </asp:BoundField>
                            <asp:BoundField DataField="taxPercent" ItemStyle-HorizontalAlign="Center"  ItemStyle-Width="5%" HeaderText="Tax%">
    <ItemStyle HorizontalAlign="Right" Width="5%"></ItemStyle>
                            </asp:BoundField>
                            <asp:BoundField DataField="discount" ItemStyle-HorizontalAlign="Center"  ItemStyle-Width="5%" HeaderText="Discount%">
    <ItemStyle HorizontalAlign="Right" Width="5%"></ItemStyle>
                            </asp:BoundField>
                            <asp:BoundField DataField="isActive" ItemStyle-HorizontalAlign="Center"  ItemStyle-Width="5%" HeaderText="Active">
    <ItemStyle HorizontalAlign="Center" Width="5%"></ItemStyle>
                            </asp:BoundField>

                 <asp:TemplateField HeaderText="Select">
                     <ItemTemplate >
                         <asp:LinkButton id="lnkselect" Text="Select" runat ="server"  CommandName="Select"  >Select</asp:LinkButton>

                     </ItemTemplate>
                 </asp:TemplateField>

             </Columns>

         </asp:GridView>

     <asp:SqlDataSource ID="GridDataSource" runat="server"  ConnectionString="<%$ Appsetting:Appsettings %>"
        SelectCommand="SELECT ProductcatID,productcode,barcode FROM Product_Master" FilterExpression="barcode LIKE '{0}%'">
        <FilterParameters>
            <asp:ControlParameter Name="barcode" ControlID="barcodeTxt" PropertyName="Text" />
        </FilterParameters>
    </asp:SqlDataSource > 

    --------------------------------------------------------------------------------------------------------------------------------

    App config

    <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
        <!--add key="sqlConBillingSystem" value="Data Source=technoglobiadb.database.windows.net;Integrated Security=SSPI;Initial Catalog=Billpayment;User id=billingSyetemDBUser;Password=user$DB;"/-->
        <add key="sqlConBillingSystem" value="Data Source=technoglobiadb.database.windows.net;Initial Catalog=Billpayment_Dev;User id=technoglobia;Password=Techno@DB;"/>
        <add key="logFilePath" value ="E:\_Development\_Logs\BillingSystem\wcfBillingSystem\"/>
      </appSettings>
      <connectionStrings>
       
      </connectionStrings>

    plzzzz help me guys

    • Moved by CoolDadTx Tuesday, February 13, 2018 3:00 PM ASP.NET related
    Tuesday, February 13, 2018 7:15 AM

All replies

  • Hello,

    You should post this question in the ASP.NET DataSource controls - SqlDataSource forum which is not part of these forums.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Tuesday, February 13, 2018 10:29 AM