how can I set the size of the grid Items in a GridView control so that the Items will auto re-size to fill the screen . for example if there was 2 items each will fill half of the screen and if there was 3 each will take the third and so on .. thanks
1 に答える
0
ItemStyle.Width
列定義でプロパティを使用します。
列を使用していない場合autogenerated
は、関心のある列の幅を設定します。
動的に生成された列を使用している場合は、コード ビハインドで幅を設定する必要があります。
以下を参照してください。
protected void TextBox1_TextChanged (object sender, EventArgs e)
{
Label1.Text = "";
try
{
int colWidth = Int16.Parse(Server.HtmlEncode(TextBox1.Text));
if (colWidth > 0)
{
for (int i = 0; i < GridView1.Columns.Count; i++)
{
GridView1.Columns[i].ItemStyle.Width = colWidth;
}
}
}
catch
{
Label1.Text = "An error occurred."
}
}
このMSDNを確認してください:
http://msdn.microsoft.com/en-us/library/ms178296.aspx
参照リンク:
于 2013-05-03T08:58:53.420 に答える