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

Grid Databinding confudes

1 Answer 38 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Christian
Top achievements
Rank 1
Christian asked on 29 Apr 2009, 03:28 PM
Dear Support and comunnity,

I'm really confused. I try to bind a grid in a very simple and codeless way.
The db is an access mdb with one table for testing,

It doesn't matter what I'm doing, Edit, delete, insert or refresh, because I add an item manuely, nothing
happends right no. No action ist execute.

Can someone tell me why. Hope its not to simple ;-)

Here ist the link to the demo VSO 2008 project:

DemoWithGrid


Thanks a lot.
Christian

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 30 Apr 2009, 06:26 AM
Hi Christian,

I have checked your code and found that you have not set  AllowAutomaticUpdatesAllowAutomaticDeletes and AllowAutomaticInserts property of the RadGrid to true. Set it to true to perform the automatic operations.

ASPX:
 
<telerik:RadGrid ID="RadGrid1"  AllowAutomaticUpdates="true"  AllowAutomaticDeletes="true" AllowAutomaticInserts ="true"    AllowMultiRowSelection="true"   DataSourceID="AccessDataSource1" runat="server" > 

Also here is the modified code which worked on my end.

 
<asp:AccessDataSource ID="AccessDataSource1" runat="server"  
         DataFile="/App_Data/Data.mdb" 
            DeleteCommand="DELETE FROM [Test] WHERE [ID] = @ID"  
            InsertCommand="INSERT INTO [Test] ([Titel], [Prio], [Date]) VALUES (@Titel,@Prio, @Date)"  
            SelectCommand="SELECT [ID], [Titel], [Prio], [Date] FROM [Test]"  
            UpdateCommand="UPDATE [Test] SET [Titel] = @Titel, [Prio] = @Prio, [Date] = @Date WHERE [ID] = @ID"
            <DeleteParameters> 
                <asp arameter Name="ID" Type="Int32" /> 
            </DeleteParameters> 
            <UpdateParameters> 
                <asp arameter Name="Titel" Type="String" /> 
                <asp arameter Name="Prio" Type="String" /> 
                <asp arameter Name="Date" Type="DateTime" /> 
                <asp arameter Name="ID" Type="Int32" /> 
            </UpdateParameters> 
            <InsertParameters> 
                <asp arameter Name="ID" Type="Int32" /> 
                <asp arameter Name="Titel" Type="String" /> 
                <asp arameter Name="Prio" Type="String" /> 
                <asp arameter Name="Date" Type="DateTime" /> 
            </InsertParameters> 
        </asp:AccessDataSource>  

Hope this helps..
Shinu.




Tags
Grid
Asked by
Christian
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or