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

How to Disable Databinding during Insert new Row Button Click

4 Answers 71 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ankit
Top achievements
Rank 1
Ankit asked on 30 Jul 2012, 06:04 AM
As i click on the Insert new Row,  the Grid goes into databinding and i just want to disable the databinding to the Edit Template during insert new row, how is it possible ?

Secondly how is it possible that during edit mode it is able to recognize a dataitem to which the textbox is binded to and during add new row command it displays the error  ‘Telerik.WebControls.GridInsertionObject does not contain a property’ ??

4 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 30 Jul 2012, 06:16 AM
Hello,

For First issue:
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == RadGrid.InitInsertCommandName)
        {
            e.Canceled = true;
        }
    }


Thanks,
Jayesh Goyani
0
Ankit
Top achievements
Rank 1
answered on 30 Jul 2012, 06:33 AM
@jayesh 

What i want is that as i click the add new row button the page goes again into bind mode and all i want is to disable the databinding to the edit/Insert mode item template not canceling the insert item template loading as the above code would cancel the data binding as well the insert mode template loading..
0
Ankit
Top achievements
Rank 1
answered on 30 Jul 2012, 12:04 PM
@Admins

Does the creators also don't know anything about this...Totally weird..
0
Maria Ilieva
Telerik team
answered on 02 Aug 2012, 08:12 AM
Hi Ankit,

I'm not completely sure what exactly your requirements are. However note that it is not possible to prevent only the insert form to be bind. You could clear it using the following:

Protected Sub RadGrid1_ItemCommand(sender As Object, e As Telerik.Web.UI.GridCommandEventArgs)
    If e.CommandName = RadGrid.EditCommandName Then
        Me.RadGrid1.MasterTableView.IsItemInserted = False
    ElseIf e.CommandName = RadGrid.InitInsertCommandName Then
        Me.RadGrid1.MasterTableView.ClearEditItems()
    End If
End Sub


Greetings,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Ankit
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Ankit
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or