Board index » Web Programming » prevent DropDownList from displaying in GridView column if it's em
|
pehuan
|
|
pehuan
|
prevent DropDownList from displaying in GridView column if it's em
Web Programming26
I have a number of rows in a GridView Column which don't have values for the DropDownList, is there a way to hide the control if it has no data? Here's my code: <ItemTemplate> <asp:DropDownList ID="RideDatesDropDownList" runat="server" DataSourceId="RideDatesSqlDataSource" DataTextField="RideDate" DataValueField="RideDate" DataTextFormatString="{0:MMM yyyy}" CssClass="waDropDownList"> </asp:DropDownList> Thanks for any clues on this. - |
| WEBSWAPP
Registered User |
Tue Apr 04 10:51:02 CDT 2006
Re:prevent DropDownList from displaying in GridView column if it's em
Consume the DataBound event of the dropdownlist, e.g.
OnDataBound="ShowHideDDL" Then write a protected method in the codebehind like this: protected void ShowHideDDL(object sender, EventArgs e) { DropDownList ddl= (DropDownList) sender; ddl.Visible= (ddl.Items.Count>0); } -- HTH, Phillip Williams www.societopia.net">www.societopia.net www.webswapp.com">www.webswapp.com "Dabbler" wrote: QuoteI have a number of rows in a GridView Column which don't have values for the |
| Dabbler
Registered User |
Tue Apr 04 14:13:01 CDT 2006
Re:prevent DropDownList from displaying in GridView column if it's emWow Phillip, that was simple and worked on the first try! So many events, so little time. Thanks much. "Phillip Williams" wrote: QuoteConsume the DataBound event of the dropdownlist, e.g. |
