Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
490 views
Can you statically define a column in a radgrid, dynamically add another column, and then manipulate either column in the grid's ItemDataBound event?

First I statically defined a RadGrid such as the following:

<telerik:RadGrid ID="grdResults" Height="100%" runat="server" OnNeedDataSource="grdResults_NeedDataSource" OnItemDataBound="grdResults_ItemDataBound" GridLines="None" AllowSorting="true" AllowPaging="false" AutoGenerateColumns="false">
    <ClientSettings>
        <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="false" />
        <Selecting AllowRowSelect="true" />
    </ClientSettings>
    <MasterTableView>
        <Columns>             
          
<telerik:GridBoundColumn HeaderText="StatusCodeDescription" UniqueName="StatusCodeDescription" DataField="StatusCodeDescription" HeaderStyle-Width="8%"></telerik:GridBoundColumn>
  
        </Columns>
    </MasterTableView>
</telerik:RadGrid>


then dynamically add a column in the page load like:

if (!Page.IsPostBack)
{
    var boundColumn = new GridBoundColumn();
    e.GridColumns.Add(boundColumn);
 
    boundColumn.HeaderText = "Select";
    boundColumn.DataField = "Id";
    boundColumn.UniqueName = "selectId";
}

and still use the ItemDataBound event to manipulate the dynamically added column?  
I can retrieve and manipulate the statically defined column, but I am unable to do the same for the 
dynamically added column?  

What am I doing wrong?


private void GridItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        var item = (GridDataItem)e.Item;
        item["selectId"].Text = "test";
 
     if (item["StatusCodeDescription"].Text.Length > 5)
            item["StatusCodeDescription"].Text = item["StatusCodeDescription"].Text.Substring(0, 2) + "...";
   }
}

Shinu
Top achievements
Rank 2
 answered on 24 Jun 2011
2 answers
72 views
Hi,

I want to click on the Scheduler MonthView one day, DayView don't show,Is through the attribute to set or through the events to set.

Thanks a lot!!

Regards

zh2yu
Top achievements
Rank 1
 answered on 24 Jun 2011
7 answers
187 views
Hi,

As mentioned in a previous thread, am using the solution in this thread to hide/ unhide columns.

In my scenario, out of the 10 columns in the grid am displaying 6 when am first loading the page. Am using checkboxes to hide/unhide each column.

Am facing a problem displaying the columns that are hidden on pageload. Am able to hide/unhide the 6 columns that are displayed on page load. Am guessing this might be due to the viewstate too.

Any suggestions to fix this would be helpful.

Thank you.
David
Top achievements
Rank 1
 answered on 23 Jun 2011
2 answers
93 views
When I set the width of a RadEditor in a RadGrid, the content area is wider than the Editor (I mean I have an horizontal scrollbar). How could I avoid that?

My code to set the Editor's width is:

protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                GridEditableItem editedItem = e.Item as GridEditableItem;
                GridHTMLEditorColumnEditor editor = (GridHTMLEditorColumnEditor) editedItem.EditManager.GetColumnEditor(colName);
                editor.Editor.Width = Unit.Pixel(750);
           [...]
jc mag
Top achievements
Rank 1
 answered on 23 Jun 2011
7 answers
279 views
I have a Radgrid Control on my aspx page with one hyperlink column I bind my grid with my datatable.  But the hyperlink column data will point to different urls, depends on its value. I need to check  the values on every rowbound and then setup the url for that row. How do I do that.
ervin
Top achievements
Rank 1
 answered on 23 Jun 2011
0 answers
62 views
I have a RadGrid that is used to update items to a different status. A user is given a list of status's in a drop down and the can choose what status to change the item to. I'm not sure the best way to go about this, but I would like to popup a modal window or some type of form where the user has to fill in more information if they try to update an item with a certain status. Basically if a user selects a certain status and tries to update the row they would be prompted to fill out more information. Any suggestions on the best way to go about this would be appreciated. 
William
Top achievements
Rank 1
 asked on 23 Jun 2011
1 answer
70 views
Hi ,
I am using Rad Upload Control In my page  , i have set ControlObjectVisibility to None. I have One scenario to work on Rad Upload , 
Fist of all  i dont have any button to post back for uploading Files and I have to choose only image files. I m having asp.Image control above my radupload, when i select the image , i have to show the seleceted image in asp.Image conrol , that can be either in server or client side. Can you give me better idea or soultion to how to do the above scenario
Peter Filipov
Telerik team
 answered on 23 Jun 2011
1 answer
164 views
The grid border disappears when the columns are expanded on google chrome.

following code is added to allow resiziing of columns:


<ClientSettings>

                          <Resizing EnableRealTimeResize="True" AllowColumnResize="True"></Resizing>
             
                </ClientSettings>
Maria Ilieva
Telerik team
 answered on 23 Jun 2011
1 answer
59 views
Hi,

I have a web page where we have used Rad Editor. We have not mentioned any skin to control and its taking a Default skin. Now when i try to change the skin its not reflecting on page. Please update us why is this happeneing?
Rumen
Telerik team
 answered on 23 Jun 2011
2 answers
81 views
Hello All,

  I have a grid. I have several small grids inside the grid. I want to export the grid to MS word using RadGrid1.MasterTableView.ExportToWord();
This works fine, but when I do   RadGrid1.ExportSettings.IgnorePaging = true; then the small grids inside the bigger grid starts throwing error. I get the error message that small grid is null. I am doing the find of the small grid in
RadGrid1_ItemDataBound. below is my code

protected void RadGrid1_itemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        RadGrid RadGrid_DetailsHeader = (RadGrid)e.Item.FindControl("RadGrid_DetailsHeader");
        RadGrid_DetailsHeaderBind(casRepHeader, RadGrid_DetailsHeader);
    }
     
}
In the above code RadGrid_detailsHeader is my small grid inside RadGrid1. when I write the ignorePaging command, this radGrid_detailsHeader becomes null. I am not sure what am I doing wrong. I need to print this grid with paging. I have five grids inside the big grid.

I spend my whole day trying to work this out, but without success. I am willing to use Telerik reporting option or any other way is also fine.

I have to export this grid to MS word and Excel.

I really really need help with this one.

Any help or tips will be greatly appreciated.
Anjali
Top achievements
Rank 1
 answered on 23 Jun 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?