Hello,
i want to use RadGrid in asp.net with dynamical columns with different widths. There is no autosizing like autofit. I tried it with javascript. It works but it isnt a good solution. I tried here with some functions, but nothing happens on sizing. Only text will be changed. Visible unvisible is also not working. I think telerik is in grid a very bad solution.
in page:
<telerik:RadGrid ID="rgrdSuche" runat="server" Culture="de-DE" OnColumnCreated="rgrdSuche_ColumnCreated" OnSortCommand="rgrdSuche_SortCommand">
<MasterTableView AutoGenerateColumns="true" AllowFilteringByColumn="false">
</MasterTableView>
</telerik:RadGrid>
i tried with the event itemdatabound, but nothing happened:
protected void rgrdSuche_ItemDataBound(object sender, GridItemEventArgs e)
{
try
{
if (e.Item is GridHeaderItem)
{
GridHeaderItem headerItem = e.Item as GridHeaderItem;
for (int i = 0; i < headerItem.Cells.Count; i++)
{
switch (headerItem.Cells[i].Text.Replace(" ", ""))
{
case "Comment":
headerItem.Cells[i].Text = "Comment-Text";
headerItem.Cells[i].Width = Unit.Pixel(400);
break;
default:
break;
...
and event via ColumnCreated will not work also:
protected void rgrdSuche_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
{
switch (e.Column.UniqueName)
{
case "Comment":
e.Column.Visible = false;
e.Column.HeaderText = "Comment-Text";
e.Column.HeaderStyle.Width = Unit.Pixel(400);
e.Column.FilterControlWidth = Unit.Pixel(400);
break;