Hi,
I'm using dynamic columns boundfield and templatefield in gridview, the GV embeded in a panel (autoscroll:auto;width:fixe), I fixed 3 columns to fit the panel's width , when I add exceed the 3 columns the width changes !
Printable View
Hi,
I'm using dynamic columns boundfield and templatefield in gridview, the GV embeded in a panel (autoscroll:auto;width:fixe), I fixed 3 columns to fit the panel's width , when I add exceed the 3 columns the width changes !
Hey,
Can you show the markup that you are using?
Gary
I need to recreate columns and rebind the gridview when I modify items .
Quote:
// create Left Box columns
this.leftBox.AutoGenerateColumns = false;
this.leftBox.Columns.Clear();
TemplateField tf = new TemplateField();
this.leftBox.Columns.Add(tf);
tf.ItemTemplate = new CheckBoxTemplateHandler();
tf.ItemStyle.Height = 30;
tf.ItemStyle.Width = 30;
for (int x = 1; x <= this.LeftBoxColumns; x++)
{
if (x <= this.LeftBoxColumns)
{
BoundField nameColumn = new BoundField();
nameColumn.DataField = x.ToString();
if (x == 1)
{
nameColumn.ItemStyle.Width = 70;
nameColumn.ItemStyle.Height = 30;
}
else
{
nameColumn.ItemStyle.Width = 220;
nameColumn.ItemStyle.Height = 30;
}
this.leftBox.Columns.Add(nameColumn);
}
}
// bind Data
this.leftBox.DataSource = DTSourceBox;
this.leftBox.DataBind();
That is the server side code, I was asking about the ASPX markup, i.e. your panel, and it's surrounding elements.
Gary
I'm working with Custom Server control , for the panel and it's surrounding elements see the code below :
this was in initialization .Quote:
this._leftBoxContainer.ID = "LeftBoxContainer";
this._leftBoxContainer.Height =(this.LeftBoxRows*30)+20;
this._leftBoxContainer.Width = 320;
this._leftBoxContainer.ScrollBars = ScrollBars.Auto;
this._leftBoxContainer.BorderWidth = 2;
this._leftBoxContainer.GroupingText = "UnBound";
That's still server side code, he's looking for the markup (the HTML looking page).
Are you saying that you are dynamically generating all the controls on the page? Is there nothing in the ASPX markup?
Gary
Mrs ,
do you mean ASPx Markup at runtime ! I work on a custom server control that contains gridview with dynamic columns .
Hold on.
So you are doing a "true" Server Control, not a composite one. So you are handling all the control generation in the server side code. Correct?
If so, is it possible for you to show all the code that you are using?
Gary
I think that I gave you the necessary , I hope find someone met the same problem .
Thank you.
Well not really no.
You have provided some sample code, yes, however, there are so many other things that could be causing the problem that you are having, so without directly running the code that you are using, it will be difficult to replicate on my machine.
I am not expecting you to upload all your code, but rather a sample of it. i.e. one complete webpage, that is rendering your control, so that I can see the problem that you are having, and make suggestions.
Gary
sorry I'm late,
the Markup in short is :the GridView is embedded in a Panel(style fixed).Quote:
<td style:"Height:30px;Width:200px"> Text <td/>
I hope that Css can help.
Any suggestions ?
souloff,
Why are you so hesitant in showing us complete sections of code?
What you have provided isn't enough for anyone to try and help you. We would need a complete sample of the ASPX that you are using to include your server control, as well as all the code used to render your control.
That way, we can take it, and try and reproduce the problem on our systems, and then make suggestions as to how to proceed.
Gary
I would to simplify things,
Code :
Quote:
<table id="Control">
<tr>
<td align="center"><div id="Control" style="border-width:2px;border-style:solid;height:200px;width:320px;overflow:auto;">
<div>
<table cellspacing="0" rules="all" border="1" id="Control" style="color:Black;background-color:White;border-collapse:collapse;">
<tr>
<td style="height:30px;width:30px;"><input id="Control_ctl13_cbselect" type="checkbox" name="Control13$cbselect" onclick="javascript:setTimeout('__doPostBack(\'Control13$cbselect\',\'\')', 0)" /></td><td style="height:30px;width:70px;">A102</td><td style="height:30px;width:220px;">ppppppppppppp</td><td>3</td><td>hhhhhhhhhhhhh</td>
</tr><tr>
<td style="height:30px;width:30px;"><input id="Control_ctl14_cbselect" type="checkbox" name="Control14$cbselect" onclick="javascript:setTimeout('__doPostBack(\'Control14$cbselect\',\'\')', 0)" /></td><td style="height:30px;width:70px;">A200</td><td style="height:30px;width:220px;">kkkkkkkkkkkkk</td><td>20</td><td>hhhhhhhhhhhh</td>
</tr><tr>
<td style="height:30px;width:30px;"><input id="Control_ctl15_cbselect" type="checkbox" name="Control15$cbselect" onclick="javascript:setTimeout('__doPostBack(\'Control15$cbselect\',\'\')', 0)" /></td><td style="height:30px;width:70px;">A201</td><td style="height:30px;width:220px;">yyyyyyyyyyyyyyyy</td><td>15</td><td>Ihhhhhhhhhhhh</td>
</tr><tr>
<td style="height:30px;width:30px;"><input id="Control_ctl16_cbselect" type="checkbox" name="Control16$cbselect" onclick="javascript:setTimeout('__doPostBack(\'Control16$cbselect\',\'\')', 0)" /></td><td style="height:30px;width:70px;">A202</td><td style="height:30px;width:220px;">yyyyyyyyyyyyyy</td><td>12</td><td>Ihhhhhhhh</td>
</tr><tr>
<td style="height:30px;width:30px;"><input id="Control_ctl17_cbselect" type="checkbox" name="Control17$cbselect" onclick="javascript:setTimeout('__doPostBack(\'Control17$cbselect\',\'\')', 0)" /></td><td style="height:30px;width:70px;">A203</td><td style="height:30px;width:220px;">tttttttttttttttttttttttt</td><td>12</td><td>hhhhhhhhh</td>
</tr><tr>
<td style="height:30px;width:30px;"><input id="Control_ctl18_cbselect" type="checkbox" name="Control18$cbselect" onclick="javascript:setTimeout('__doPostBack(\'Control18$cbselect\',\'\')', 0)" /></td><td style="height:30px;width:70px;">A204</td><td style="height:30px;width:220px;">rrrrrrrrrrrrrr</td><td>13</td><td>Ihhhhhhh</td>
</tr><tr>
<td style="height:30px;width:30px;"><input id="Control_ctl19_cbselect" type="checkbox" name="Control19$cbselect" onclick="javascript:setTimeout('__doPostBack(\'Control19$cbselect\',\'\')', 0)" /></td><td style="height:30px;width:70px;">Vol-001</td><td style="height:30px;width:220px;">qqqqqqqqqqqqqqqqqqqtd><td>10</td><td>hhhhhhhhhh</td>
</tr><tr>
<td style="height:30px;width:30px;"><input id="Control_ctl20_cbselect" type="checkbox" name="Control20$cbselect" onclick="javascript:setTimeout('__doPostBack(\'Control20$cbselect\',\'\')', 0)" /></td><td style="height:30px;width:70px;">AR06TB</td><td style="height:30px;width:220px;">xxxxxxxxxxxxx</td><td>8</td><td>hhhhhhhhhh</td>
</tr>
</table>
solved by defining gridviews width.
If your question has been answered, can you remember to go back and mark your thread as resolved?
Gary