Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Dynamic column-label or linkbutton?

Reply
Thread Tools

Dynamic column-label or linkbutton?

 
 
Adam Smith
Guest
Posts: n/a
 
      01-30-2004


How do I dynamically decide on a column type depending upon my data.
I.E., what I want to do is (But get a compile error in browser on syntax
of missing '}'):

<asp:TemplateColumn HeaderText="MyColumn">
<ItemTemplate>
<%# String if(DataBinder.Eval(Container,
"DataItem.MyColmn")==null){ %>
<asp:label id=label1 runat=server text="nodata"/>
<% }else{%>
<asp:ButtonColumn Text="Jump to Data" CommandName="Jump"/>
<% }%>
</ItemTemplate>
</asp:TemplateColumn>


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
 
Earl Teigrob
Guest
Posts: n/a
 
      01-30-2004
I could not find a a way of doing this AND maintianing view state without
creating a Custom Column Control and either modifying its controls visible
property in the itemDataBound event or using DataBinding Data to
conditionally load controls within the custom colomn control itself. Chaper
12 of "ASP.NET Data Web Controls" by Scott Mitchell explains Custom Columns
very well.

Earl


"Adam Smith" <> wrote in message
news:...
>
>
> How do I dynamically decide on a column type depending upon my data.
> I.E., what I want to do is (But get a compile error in browser on syntax
> of missing '}'):
>
> <asp:TemplateColumn HeaderText="MyColumn">
> <ItemTemplate>
> <%# String if(DataBinder.Eval(Container,
> "DataItem.MyColmn")==null){ %>
> <asp:label id=label1 runat=server text="nodata"/>
> <% }else{%>
> <asp:ButtonColumn Text="Jump to Data" CommandName="Jump"/>
> <% }%>
> </ItemTemplate>
> </asp:TemplateColumn>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Variables? OR Dynamic Controls =?Utf-8?B?VGVyb3M=?= ASP .Net 1 08-10-2004 01:13 PM
Dynamic control on aspx page, dynamic location Chris Thunell ASP .Net 3 07-21-2004 04:52 PM
VPN between 2 Cisco routers (1 static, 1 dynamic) with access from stat --> dynamic over ISDN Hans-Peter Walter Cisco 3 01-21-2004 02:12 PM
Does Pix or cisco router support dynamic-to-dynamic IPSec VPN? c Cisco 2 01-13-2004 01:53 AM
Re: Dynamic Table with Dynamic LinkButtons Rick Glos ASP .Net 0 07-08-2003 01:09 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57