Click here to Skip to main content
13,088,101 members (69,352 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Below i have grid showing colors

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
       Dim clrname() = {"White", "Yellow Orange", "Sunglow", "Inchworm", "Mountain Meadow", "Fuzzy Wuzzy", "Mahogany"}
       Dim clr() = {"#ffffff", "#ffae42", "#ffcf48", "#b2ec5d", "#30ba8f", "#cc6666", "#cd4a4c"}

       Dim dt As New Data.DataTable
       For i As Integer = 0 To clr.Length - 1
       GridView1.DataSource = dt

       For i As Integer = 0 To clr.Length - 1
           Dim t As Button = GridView1.Rows(i).FindControl("Button2")
           Dim nm As String = clr(i)
           t.BackColor = Drawing.Color.FromName(nm)
           t.Attributes.Add("OnClick", "return colour(this);")
           t.Text = clrname(i)
   End Sub

Grid Displaying colors
<asp:GridView ID="GridView1" BorderStyle="solid" BorderColor="black" BorderWidth="1px"  runat="server" AutoGenerateColumns="False">

             <asp:TemplateField HeaderText="Color">
             <ItemTemplate >
               <asp:Button ID="Button2" style="border:solid 1px black;width:100px;height:30px;cursor:pointer" runat="server" Text="" />


in Grid textbox i need to display above grid so that i can select color
<asp:GridView ID="GridView2" BorderStyle="solid" BorderColor="black" BorderWidth="1px"  runat="server" AutoGenerateColumns="True">
            <asp:TemplateField HeaderText="ColorBox">
                <ItemTemplate >
               <asp:TextBox ID="TextBox1"  runat="server" class=""  BorderColor="White" Height="20px" Width="102px"></asp:TextBox>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br />

Posted 25-Apr-13 23:10pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170813.1 | Last Updated 26 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100