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

[Solved] Radgrid does not show insert button (Manual binding)

3 Answers 276 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lars
Top achievements
Rank 1
Lars asked on 24 Aug 2009, 12:29 PM
Hi,

i have a problem, inserting new items into my radgrid. The Button didn't appear on the grid.

Couldn't find a solution on this forum so far. Could anybody help?
What is missing?

Thanks in advance!

Lars

<telerik:RadGrid ID="RadGrid1" runat="server" width="500px" GridLines="None"   
                     AllowAutomaticInserts="True" AllowAutomaticUpdates="True"   
                     AutoGenerateColumns="False" AutoGenerateEditColumn="True"   
                     ShowFooter="True" ShowStatusBar="True" AllowPaging="True" PageSize="5"   
                     Skin="Telerik">     
        <mastertableview editmode="EditForms"   
                         enableheadercontextmenu="True"   
                         insertitempageindexaction="ShowItemOnFirstPage"   
                         ShowGroupFooter="True" InsertItemDisplay="Bottom" 
                         DataKeyNames="UID">  
            <Columns> 
                <telerik:GridBoundColumn   
                    DataField="UID" ReadOnly="True"   
                    HeaderText="UID" UniqueName="UID" Visible="false">  
                </telerik:GridBoundColumn>      
                <telerik:GridBoundColumn DataField="DCId" ReadOnly="True"   
                        HeaderText="DCId" UniqueName="DCId">  
                    <ItemStyle Width="100" /> 
                </telerik:GridBoundColumn>              
                <telerik:GridBoundColumn DataField="MRDR_NR" HeaderText="MRDR_NR" UniqueName="MRDR_NR">  
                    <ItemStyle Width="100" /> 
                </telerik:GridBoundColumn> 
            </Columns>                                                          
        </mastertableview>      
    </telerik:RadGrid> 

The data was bind manually
private void WSDataBind()  
{  
        WholesalerBM oWholeSalerBM = new WholesalerBM();  
        WholesalerFilter oWholesalerFilter = new WholesalerFilter();  
        oWholesalerFilter.WholesalerUID = new Guid ("36C68452-36BF-4FF2-8E32-39DAB8490839");  
 
        WholesalerDataSet oWholesalerDataSet = oWholeSalerBM.SelectWholesalerWithRelations(oWholesalerFilter, true);  
        Session[_strWholesalerDataSet] = oWholesalerDataSet;  
 
        RadGrid1.DataSource = oWholesalerDataSet.WholesalerMRDR;  
        RadGrid1.DataBind();  




3 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetoslav
Telerik team
answered on 24 Aug 2009, 12:34 PM
Hello Lars,

Try setting CommandItemDisplay to Top or Bottom for the master table view of the grid.

I hope this helps.

Sincerely yours,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Lars
Top achievements
Rank 1
answered on 24 Aug 2009, 12:48 PM
Thanks, that helps. ;-)

Could you also give me a hint, how i can handle different state's of the readonly flag of GridBounColums at this point for editing or inserting?
Some Datafields should be only visible, when i am inserting, but not by editing.

Thanks!
0
Accepted
Princy
Top achievements
Rank 2
answered on 24 Aug 2009, 01:19 PM
Hello Lars,

You can try out the following code to hide the column from displaying in EditMode but show it in the insert mode the grid:
c#:
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    {       
        if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode) && (!e.Item.OwnerTableView.IsItemInserted)) 
        { 
            GridEditFormItem item = (GridEditFormItem)e.Item;            
            item["columnUniqueName"].Parent.Visible = false
            
        }  
    } 

Thanks
Princy.
Tags
Grid
Asked by
Lars
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Lars
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or