Column Header with Variable

H

Hai

Dear gurus,

Is it possible to specify the column header with variable?
If I want to make headerText as Sales and Credit how do I do so?

Thanks in Advance.
Hai


'Here the codes

Dim s1,s2 as string
s1 = "Sales"
s2 = "Credit"

<asp:DataGrid
ID="mygrid1"
AutoGenerateColumns="False"
Runat="Server">
<Columns>
<asp:BoundColumn DataField="REPNAME" HeaderText="REPNAME" />
<asp:BoundColumn DataField="month1" HeaderText=s1 />
<asp:BoundColumn DataField="month2" HeaderText=s2 />
<asp:BoundColumn DataField="total" HeaderText="TOTAL" />
</columns>

</asp:DataGrid>
 
A

Alvin Bruney [MVP]

the header text is handled the same as an ordinary cell in either the
itemdatabound or itemcreated event handler. test the cell contents first to
make sure you have the right cell
if(listitemtype.header == e.item.type)
//do something

roughly
 
H

Hai

Thank you Alvin
Hai
Alvin Bruney said:
the header text is handled the same as an ordinary cell in either the
itemdatabound or itemcreated event handler. test the cell contents first to
make sure you have the right cell
if(listitemtype.header == e.item.type)
//do something

roughly

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Hai said:
Dear gurus,

Is it possible to specify the column header with variable?
If I want to make headerText as Sales and Credit how do I do so?

Thanks in Advance.
Hai


'Here the codes

Dim s1,s2 as string
s1 = "Sales"
s2 = "Credit"

<asp:DataGrid
ID="mygrid1"
AutoGenerateColumns="False"
Runat="Server">
<Columns>
<asp:BoundColumn DataField="REPNAME" HeaderText="REPNAME" />
<asp:BoundColumn DataField="month1" HeaderText=s1 />
<asp:BoundColumn DataField="month2" HeaderText=s2 />
<asp:BoundColumn DataField="total" HeaderText="TOTAL" />
</columns>

</asp:DataGrid>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top