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

[Solved] Setting default value in inserted row

1 Answer 178 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Roel
Top achievements
Rank 1
Roel asked on 06 Feb 2008, 11:39 PM
Hi,

I am trying to set a default value in a textbox when a new row is inserted in the grid. 
I tried the code below, but that never passes the condition of the if-statement.. I am using the standard in-line editing.
 

Protected Sub gridActivities_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles gridActivities.ItemDataBound
    If (TypeOf e.Item Is GridEditFormInsertItem) AndAlso (gridActivities.MasterTableView.IsItemInserted) Then
        Dim insertItem As GridEditFormInsertItem = CType(e.Item, GridEditFormInsertItem)
        'getting the Textbox in the insert form using it's UniqueName
        Dim txbCategoryID As TextBox = CType(insertItem("intCategory").Controls(0), TextBox)    
        txbCategoryID.Text = Request.QueryString(
"Category")
    End If
End Sub

What am I doing wrong?

1 Answer, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 08 Feb 2008, 06:37 AM
Hi Roel,

When using inline editing you should be checking the type of e.Item for GirdDataInsertItem. For an alternative solution you can check this help topic:

http://www.telerik.com/help/aspnet/grid/?grdInsertingValuesInPlaceAndEditForms.html

Hope this helps.

Greetings,
Ves
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Roel
Top achievements
Rank 1
Answers by
Ves
Telerik team
Share this question
or