hi,
U can do it as follow
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>
<style type="text/css">
.column1
{
word-break: break-all;
width: 40px;
}
.column2
{
word-break: break-all;
width: 80px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" OnRowDataBound="GridView1_RowDataBound"
Style="position: static">
</asp:GridView>
</div>
</form>
</body>
</html>
*********** code behind
DataTable myTable;
protected void Page_Load(object sender, EventArgs e)
{
myTable = new DataTable();
myTable.Columns.Add("ID", typeof(Int32));
myTable.Columns.Add("Name", typeof(String));
myTable.Columns.Add("Job", typeof(String));
myTable.Rows.Add(1, "aaa","test");
myTable.Rows.Add(2, "bbbbbbbbbbbbbbbbbbbb","testtest");
myTable.Rows.Add(3, "ccc","testtesttesteetststetstest");
GridView1.DataSource = myTable;
GridView1.DataBind();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[1].CssClass = "column1";
e.Row.Cells[2].CssClass = "column2";
}
From:
Himanshu Hajariwala
IF IT HELPS YOU THEN KINDLY PRESS THE "ANSWER" BUTTON.
The shortest distance between a problem and a solution is the distance between your knees and the floor.
The one who kneels to the Lord, can stand up to anything.