Click here to Skip to main content
16,020,633 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to display colors inside my dropdownlist which is a column of grid view .. How can i provide data source for this. dynamically binding i want to do
Posted

1 solution

Hi Nilesh,

On the gridview RowDataBound bind the dropdown source


VB
Protected Sub gv_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvData.RowDataBound
       If e.Row.RowType = DataControlRowType.DataRow Then
            CType(e.Row.FindControl("ddlDropDown"), DropDownList).DataTextField="Name"
            CType(e.Row.FindControl("ddlDropDown"), DropDownList).DataValueField="ID"
            CType(e.Row.FindControl("ddlDropDown"), DropDownList).datasource= Datasource
            CType(e.Row.FindControl("ddlDropDown"), DropDownList).databind()
       End If
   End Sub



Regards,
 
Share this answer
 
Comments
Torakami 17-Jul-13 9:14am    
ok that will be workable .. but in database I have wrote only hexadecimal color value. and in drop downs i want to display colors

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900