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

How to insert Grid values using entitydatasource without primary key

6 Answers 205 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dhamodharan
Top achievements
Rank 1
Dhamodharan asked on 21 May 2014, 01:34 PM
Hi All,

I am using entitydatasource for bind the grid. it is working fine.
but i need to insert without primary key because our primary key id generated using oracle sequence. we have some auto created column using Trigger. but when i am trying to insert it is asking all columns.
how we can insert selected columns instead of all columns?
Please help ASAP. it is very urgent.

Thanks in Advance,
S.Dhamodharan.

6 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 26 May 2014, 10:14 AM
Hi Dhamodharan,

Could you please elaborate a bit more on your scenario? Do you use automatic operations via the EntityDataSource control or you insert item manually? Live example of bot approaches you can find here:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/automatic-crud-operations/defaultcs.aspx
http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/manual-crud-operations/defaultcs.aspx

Please check them out let me know if one of them helps you.

Looking forward for your reply.

Regards,
Radoslav
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Dhamodharan
Top achievements
Rank 1
answered on 27 May 2014, 07:57 AM
Hi,
     Thanks. i am coming across some issues as the default programmings like drag & drop and filtering is not working when we have enabled insert, update and delete. kindly help to overcome this issue.
0
Dhamodharan
Top achievements
Rank 1
answered on 27 May 2014, 09:16 AM
hi,
the actual problem when where caluse is given. WhereParameters cannot be specified unless AutoGenerateWhere==true or Where is specified.
0
Radoslav
Telerik team
answered on 29 May 2014, 06:59 AM
Hello Dhamodharan,

Could you please elaborate a bit more? Do you have any problems related with the RadGrid control and its integration with the EntityDataSource? If you have other issues it will be helpful if you could post your aspx markup with the related code behind file? Thus we will be able to gather more details about your scenario and provide you with more to-the-point answer.

Regards,
Radoslav
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Dhamodharan
Top achievements
Rank 1
answered on 29 May 2014, 07:30 AM
 <telerik:RadGrid ID="rgTest" runat="server" DataSourceID="EntityDataSource1"
            CellSpacing="0" GridLines="None" AllowAutomaticDeletes="True"
            AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
            AllowFilteringByColumn="True">
<MasterTableView AutoGenerateColumns="False" DataSourceID="EntityDataSource1"
            DataKeyNames="PAIN_SCA_ID" CommandItemDisplay="Top">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>

<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
    <Columns>      
        <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                </telerik:GridEditCommandColumn>
        <telerik:GridBoundColumn DataField="PAIN_SCALE_DESC"
            FilterControlAltText="Filter PAIN_SCALE_DESC column"
            HeaderText="PAIN_SCALE_DESC" SortExpression="PAIN_SCALE_DESC"
            UniqueName="PAIN_SCALE_DESC">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="DISPLAY_SEQ" DataType="System.Int16"
            FilterControlAltText="Filter DISPLAY_SEQ column" HeaderText="DISPLAY_SEQ"
            SortExpression="DISPLAY_SEQ" UniqueName="DISPLAY_SEQ">
        </telerik:GridBoundColumn>     
    </Columns>
</MasterTableView>
        </telerik:RadGrid>


<asp:EntityDataSource ID="EntityDataSource1" runat="server"  
            EnableInsert="True" EnableUpdate="True"
            ConnectionString="name=Entities" DefaultContainerName="Entities"
            EnableFlattening="False" EntitySetName="PAIN_SCALES" EnableDelete="True"
            EntityTypeFilter="" Select="" Where="grp_id=@grp_id">
            <WhereParameters>
                <asp:SessionParameter DbType="Int32" Name="grp_id" SessionField="grp_id" />
            </WhereParameters>
        </asp:EntityDataSource>

Code Behind;

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Session("grp_id") = 112
    End Sub

This is my code. i remove Where="grp_id=@grp_id" and whereParameter it is working.
There are two case i am facing problem
1. if set AllowFilteringByColumn="True" i am not able to set "where" in entitydatasoruce.
2. if set AllowFilteringByColumn="False"  i am able to set "where" in entitydatasoruce.

but i need both condition. Please let me know ASAP.


Thanks in Advance,
S.Dhamodharan.
0
Radoslav
Telerik team
answered on 02 Jun 2014, 12:18 PM
Hello Dhamodharan,

Unfortunately this is not a supported scenario in the RadGrid. When filtering of the gird is enabled it changes dynamically the Where clause of the EntityDataSource, so you cannot set it manually. To achieve the desired functionality and to have initial filtering of the RadGrid you can use the approach described into the following article:
http://www.telerik.com/help/aspnet-ajax/grid-applying-default-filter-on-initial-load.html

Additionally I am sending you a simple example which demonstrates it. Please check it out and let me know if it helps you.

Regards,
Radoslav
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Dhamodharan
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Dhamodharan
Top achievements
Rank 1
Share this question
or