This is a migrated thread and some comments may be shown as answers.

[Solved] Replace GridDatabounditem pivot

5 Answers 133 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 27 Aug 2009, 09:46 AM
Hi,

I have a radgrid displaying pivot data so the grid is auto generated.  what I want to do is replace the some of the cells with textboxes (with the cell value in it) I dont need to use the grid commands to process the updates I just need it so say the last 6 cells are editable I can then have a seperate "Apply" button where I can find the values from the server.

I have tried using the Onitemcreated and changing the flag to e.item.edit = true with the grid set to use inline edit but it always generates a edit form

any suggestions?

Thanks

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 Aug 2009, 10:51 AM
Hello Paul,

Make sure that you have set EditMode to InPlace for the mastertableview of your grid and that you have not set EditForms anywhere in your code because I tried the same scenario at my end and its working as expected.
aspx:
<telerik:RadGrid ID="RadGrid1" AllowMultiRowEdit="true" AutoGenerateColumns="true" runat="server"  
OnNeedDataSource="RadGrid1_NeedDataSource" OnPreRender="RadGrid1_PreRender" 
OnItemCreated="RadGrid1_ItemCreated"
     <MasterTableView EditMode="InPlace">            
         .... 

If this does not help, consider posting relevant code or markup here so that you would get suitable solutions.

Thanks
Shinu.
0
Paul
Top achievements
Rank 1
answered on 27 Aug 2009, 12:38 PM
Doesnt seem to work

My Code

Pageload and itemcreated

        protected void ForecastInputGrid_ItemCreated(object sender, GridItemEventArgs e)  
        {  
 
 
            if (e.Item is GridDataItem)  
            {  
                e.Item.Edit = true;  
            }  
 
 
        }  
 
 
       protected void Page_Load(object sender, EventArgs e)  
        {  
 
            if (Page.IsPostBack != true)  
            {  
                buildtree();  
                applyfilters();  
                ForecastInputGrid.MasterTableView.EditMode = GridEditMode.InPlace;  
                ForecastInputGrid.AllowAutomaticDeletes = false;  
                ForecastInputGrid.AllowAutomaticInserts = false;  
                ForecastInputGrid.AllowAutomaticUpdates = false;  
                ForecastInputGrid.AllowMultiRowEdit = true;  
              
            }  
 
 
        }  
 
 

HTML

                    <telerik:RadGrid ID="ForecastInputGrid" runat="server" 
                        OnNeedDataSource="ForecastInputGrid_NeedDataSource" AllowMultiRowEdit="True"   
                        onitemcreated="ForecastInputGrid_ItemCreated"   
                        onitemdatabound="ForecastInputGrid_ItemDataBound" > 
                        <MasterTableView EditMode ="InPlace">  
                            <RowIndicatorColumn> 
                                <HeaderStyle Width="20px" /> 
                            </RowIndicatorColumn> 
                            <ExpandCollapseColumn> 
                                <HeaderStyle Width="20px" /> 
                            </ExpandCollapseColumn> 
                        </MasterTableView> 
                    </telerik:RadGrid> 


0
Paul
Top achievements
Rank 1
answered on 27 Aug 2009, 04:53 PM
I solved my problem by switching to an ASP repeater with the Radnumeric input box (incredable control).  This is much more suited to what im after

sorry for any timewaisting
0
Paul
Top achievements
Rank 1
answered on 02 Sep 2009, 01:39 PM
Shinu,

Do you have an example with this working? I have had to change again back to trying to get this to work, I have no issues if it uses an edit form both rows go into edit mode as soon as I try and get inplace mode to work nothing happens and all the grid styling dissapears

Thanks

Paul
0
Paul
Top achievements
Rank 1
answered on 02 Sep 2009, 02:12 PM
After some digging I found the method I was using is only supported for form edit mode I have changed to put the item into edit mode in the pre render of the grid like so:

 protected void radgrid1_prerender(object sender, System.EventArgs e)  
        {  
            if (!IsPostBack)  
            {  
                foreach (GridItem item in RadGrid1.MasterTableView.Items)  
                {  
 
                    if (item is GridEditableItem)  
                    {  
                        GridEditableItem editableitem = item as GridDataItem;  
                        editableitem.Edit = true;  
                    }  
                }  
 
            } 

this now works Im just having a few issues with the column width now when the grid is in edit mode its all most 100% wider than before
Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Paul
Top achievements
Rank 1
Share this question
or