locked
reg asp.net RRS feed

  • Question

  • User-1634781740 posted

    Hi,

    I want to fetch Buttoncolor(it is a Column Name in database like green,blue etc)  , and those colors should be located in a small box in gridview

    Thanks,

    Yok

    Wednesday, May 8, 2013 1:58 AM

Answers

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 8, 2013 2:07 AM
  • User-166373564 posted

    Hi Yok

    If you want to learn the usage of GridView in asp.net, the following example demonstrates how use the GridView control to display the values from the Customers table of the AdventureWorksLT sample database in Microsoft SQL Server.

    <asp:sqldatasource id="CustomersSource"
      selectcommand="SELECT CustomerID, CompanyName, FirstName, LastName FROM SalesLT.Customer"
      connectionstring="<%$ ConnectionStrings:AWLTConnectionString %>" 
      runat="server"/>
    
    <asp:gridview id="CustomersGridView" 
      datasourceid="CustomersSource" 
      autogeneratecolumns="False"
      emptydatatext="No data available." 
      allowpaging="True" 
      runat="server" DataKeyNames="CustomerID">
        <Columns>
            <asp:BoundField DataField="CustomerID" HeaderText="CustomerID" 
                InsertVisible="False" ReadOnly="True" SortExpression="CustomerID" />
            <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" 
                SortExpression="CompanyName" />
            <asp:BoundField DataField="FirstName" HeaderText="FirstName" 
                SortExpression="FirstName" />
            <asp:BoundField DataField="LastName" HeaderText="LastName" 
                SortExpression="LastName" />
        </Columns>
    </asp:gridview>
    

    Moreover, you can also follow the GridView Class to learn detailed information,

    #GridView Class

    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx 

    hope it helps you,

    With regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 14, 2013 2:19 AM

All replies

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 8, 2013 2:07 AM
  • User-166373564 posted

    Hi Yok

    If you want to learn the usage of GridView in asp.net, the following example demonstrates how use the GridView control to display the values from the Customers table of the AdventureWorksLT sample database in Microsoft SQL Server.

    <asp:sqldatasource id="CustomersSource"
      selectcommand="SELECT CustomerID, CompanyName, FirstName, LastName FROM SalesLT.Customer"
      connectionstring="<%$ ConnectionStrings:AWLTConnectionString %>" 
      runat="server"/>
    
    <asp:gridview id="CustomersGridView" 
      datasourceid="CustomersSource" 
      autogeneratecolumns="False"
      emptydatatext="No data available." 
      allowpaging="True" 
      runat="server" DataKeyNames="CustomerID">
        <Columns>
            <asp:BoundField DataField="CustomerID" HeaderText="CustomerID" 
                InsertVisible="False" ReadOnly="True" SortExpression="CustomerID" />
            <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" 
                SortExpression="CompanyName" />
            <asp:BoundField DataField="FirstName" HeaderText="FirstName" 
                SortExpression="FirstName" />
            <asp:BoundField DataField="LastName" HeaderText="LastName" 
                SortExpression="LastName" />
        </Columns>
    </asp:gridview>
    

    Moreover, you can also follow the GridView Class to learn detailed information,

    #GridView Class

    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx 

    hope it helps you,

    With regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 14, 2013 2:19 AM