how can i display a HeaderText in a GridView Horizontaly ?
i know normaly it doesnt exist in .NET HeaderText Horizontaly but mabe a workaround with HTML or something.
i need it horizontaly cause vertical take a lot of space in my GridView and i dont have so much.
Thanks for replying, my GridView is in a Div with a Vertical Scroll,
but i think it looks better when the user doesnt need to Scroll a long moment to see all the GridView, and my Table have a lot of columns and the best way is (if their a way like this) to put the headers Horizontally then the user dont need to scroll a lot.
ok thank you and i will be happy if you find something!
On the other hand, i am thinking if we can put an HTML code inside the (HeaderText:"")
Example: <asp:BoundField DataField="Name" HeaderText= <HTML Code <i>NAME</i> HTML>
and inside this HTML something like: do this Text Horizontaly. the Problem i am not very good in HTML and i am not sure if its exists something like that ( do Text Horizontaly) i know only we can change the Text to Bold like (<b></b>) or Italian like (<i></i>)...
I'm still fighting with getting multiple lines in a dynamic gridview. Searching around led me to think that if I can change the data during the rowcreated handler this just might work.
gv2.RowCreated += new GridViewRowEventHandler(gv2_RowCreated);
protectedvoid gv2_RowCreated(object sender, GridViewRowEventArgs e)
for (int i = 0; i < 5; i++)
e.Row.Cells[i].Text.Replace(Environment.NewLine, "<br />");
Whenever I run the debugger, the new event handler line adds the handler, but never runs through the block of code. I'd imagine that during the DataBind, the rows are being created, so why isn't the system seeing this event?
"You're damned if you do, and you're damned if you dont" - Bart Simpson
Here's the code:
public partial class Subpgs_Warehouse_ShippingCalendar : System.Web.UI.Page
public Dictionary<string, string> content1 = new Dictionary<string, string>();
date = -6;
date = -7;
date = -8;
date = -9;
date = -10;
date = -11;
date = -12;
int datelist = date;
DataTable Table1 = new DataTable("last_week");
DataTable Table2 = new DataTable("this_week");
DataTable Table3 = new DataTable("next_week");
DataRow dr1 = Table1.NewRow();
for (int i = 0; i < 5; i++)
Table1.Columns.Add(DateTime.Today.AddDays(date).DayOfWeek.ToString() + " " + DateTime.Today.AddDays(date).ToShortDateString(), typeof(string));
dr1[i] = content1[DateTime.Today.AddDays(date).ToShortDateString()];
dr1[i] = "No Data supplied";
Hey Guys, I got it working. It was actually a combination of both your responses. I did have to move everything to the Page_PreLoad() and also do a RowDataBound event handler instead of RowCreated. I also had to change the event handler to this after it dawned on me that I'm replacing but not specifying that's what I want to be in the text area!