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

AllowAutomaticInsert

8 Answers 150 Views
Grid
This is a migrated thread and some comments may be shown as answers.
L
Top achievements
Rank 1
L asked on 12 May 2008, 03:59 AM
hi

I have set AllowAutomaticInsert to True but i still don't see any insert link.

Is there any tutorial that would guide me through for a newbie? I follow the online demo and i still don't get it. I would like to have a inplace insert. Thanks

8 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 12 May 2008, 05:18 AM

Hi Lui Nai Wah,

Try setting the CommandItemDisplay property and the EditMode property of your RadGrid. Check out the code snippet below:


ASPX:
<MasterTableView   CommandItemDisplay="Top"  EditMode="InPlace">    
    
</MasterTableView>    
 


Thanks
Princy.
0
L
Top achievements
Rank 1
answered on 12 May 2008, 05:32 AM
hi

Ok it works fine, but it seems that the primary key field is not enable for insert. All other fields show a textbox, but not primary key. My DB key is a nvarchar. How to enable it? Thanks
0
Shinu
Top achievements
Rank 1
answered on 12 May 2008, 05:39 AM
Hi,

Try adding one GridBoundColumn with the DataField set as the PrimaryKey Field. Sending  your aspx will be more good.

Thanks
Shinu.
0
L
Top achievements
Rank 1
answered on 12 May 2008, 06:18 AM
hi

This is my ASPX code:

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateEditColumn="True"

DataSourceID="sdsROM" GridLines="None" AllowAutomaticInserts="True"

AllowAutomaticUpdates="True" OnItemInserted="RadGrid1_ItemInserted"

DataMember="DefaultView" >

<

MasterTableView EditMode="InPlace" CommandItemDisplay="Top" AutoGenerateColumns="False" DataKeyNames="ROMID" DataSourceID="sdsROM"

DataMember="DefaultView">

<

RowIndicatorColumn Visible="False">

<

HeaderStyle Width="20px"></HeaderStyle>

</

RowIndicatorColumn>

<

ExpandCollapseColumn Visible="False" Resizable="False">

<

HeaderStyle Width="20px"></HeaderStyle>

</

ExpandCollapseColumn>

<Columns>

<telerik:GridBoundColumn DataField="ROMID" DataType="System.String"

HeaderText="ROM  ID" SortExpression="ROMID" UniqueName="ROMID">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="ROMSize" DataType="System.Int16"

HeaderText="ROM Size" SortExpression="ROMSize" UniqueName="ROMSize">

</telerik:GridBoundColumn>

</Columns>

<

EditFormSettings>

<

PopUpSettings ScrollBars="None"></PopUpSettings>

</

EditFormSettings>

</

MasterTableView>

<ClientSettings EnableRowHoverStyle="True">

</ClientSettings>

</telerik:RadGrid>

OK both show textbox when click on Add New Record, but when i click insert, it gives me this error:

Unable to cast object of type 'Telerik.Web.UI.GridDataInsertItem' to type 'Telerik.Web.UI.GridEditFormInsertItem'

Strange enough that it actually did insert a record into the DB. How do I not see this error? thanks

0
L
Top achievements
Rank 1
answered on 12 May 2008, 08:15 AM
hi

I have found the problem. Thanks
0
Shinu
Top achievements
Rank 1
answered on 12 May 2008, 09:32 AM
Hi,

Could you please send your code behind also.

Shinu.
0
L
Top achievements
Rank 1
answered on 12 May 2008, 09:54 AM
hi

Am Sorry, I meant i found the solution. Thanks
0
Peter
Top achievements
Rank 1
answered on 05 Dec 2012, 07:26 AM
I had to ensure that the ShowAddNewRecordButton was set to True:

<MasterTableView ... >
  <CommandItemSettings ShowAddNewRecordButton="true"></CommandItemSettings>
Tags
Grid
Asked by
L
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
L
Top achievements
Rank 1
Shinu
Top achievements
Rank 1
Peter
Top achievements
Rank 1
Share this question
or