JamesJGarner
JamesJGarner

Reputation: 185

How do I put <%=%> tags into asp gridview

<asp:BoundField HeaderText='<%=scheduledLogsDateCaptionValue%>' 
      DataField="DateString" 
      ItemStyle-Width="15%" 
      ItemStyle-cssclass="logtd" 
      ItemStyle-HorizontalAlign="Right"/>

Header text shows as <%=scheduledLogsDateCaptionValue%> on the site rather than the actual value, anyone know a fix?

Upvotes: 0

Views: 38

Answers (2)

Rajesh
Rajesh

Reputation: 1620

If you want to dynamically change the Header Text of the GridView you can do it in the code behind like

Gridview1.Columns[ColumnIndex].HeaderText = ds.Tables[0].Rows[0]["scheduledLogsDateCaptionValue"].ToString();

Upvotes: 0

Christian Phillips
Christian Phillips

Reputation: 18769

isn't that just the header value, so you would just add some free text in there and then have DataField=scheduledLogsDateCaptionValue?

<asp:BoundField HeaderText="Scheduled date" 
      DataField="scheduledLogsDateCaptionValue" 
      ItemStyle-Width="15%" 
      ItemStyle-cssclass="logtd" 
      ItemStyle-HorizontalAlign="Right"/>

Upvotes: 1

Related Questions