Click here to Skip to main content
11,921,889 members (59,551 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB VB.NET
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 26-Apr-13 0:10am

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

  Print Answers RSS
0 OriginalGriff 568
1 Dave Kreskowiak 285
2 Sergey Alexandrovich Kryukov 173
3 Richard MacCutchan 155
4 ppolymorphe 135
0 OriginalGriff 7,036
1 KrunalRohit 4,530
2 Sergey Alexandrovich Kryukov 3,286
3 George Jonsson 2,840
4 Suvendu Shekhar Giri 2,216

Advertise | Privacy | Mobile
Web01 | 2.8.151120.1 | Last Updated 26 Apr 2013
Copyright © CodeProject, 1999-2015
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