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

[Solved] Editmode to EditForms, how it woks

1 Answer 67 Views
Grid
This is a migrated thread and some comments may be shown as answers.
o
Top achievements
Rank 2
o asked on 22 Sep 2009, 09:38 AM

Hi,

I need help on using the Edit and custom form within the grid. this is the first time i am trying to do this, so any one can help me will be great.

I am binding the grid to datasource progmaticaly, and i set the Editmode to EditForms, and i have customized the form.

My grid have only 3 clume: Year, Start Date  and End date, and i want to enable the user to update this with in the grid, also to insert new records for each year.

so this what i am trying, and i am sure it's wrong, i am trying to read the fields first to my textbox with in the grid template for the update and then when the user click update it will update the record. so far i can not even read the data into by textboxes. Please help.

 

 

Protected Sub grid1_EditCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles grid1.EditCommand

 

ReadGrid()

 

Dim sqlstr As String

 

 

 

 

 

Dim dr As Data.SqlClient.SqlDataReader

 

sqlstr =

"select * from acc_accountyear where year='" & CType(e.Item, GridDataItem)("id").Text & "'"

 

 

 

 

dr = ACCiMS_DB.Read_DR(sqlstr)

 

While dr.Read

 

 

CType(e.Item.FindControl("txt_year"), TextBox).Text = dr("year")

 

 

CType(e.Item.FindControl("txt_sd"), TextBox).Text = dr("startdate")

 

 

CType(e.Item.FindControl("txt_ed"), TextBox).Text = dr("enddate")

 

 

End While

 

 

 

 

dr.Close()

 

End Sub


 

1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 24 Sep 2009, 04:38 PM
Hello Omar,

Please take a look at the Updating values in-place and with edit forms help topic to see the common techniques for updating a grid row when the user edits it using an edit form.

Kind regards,
Mira
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
o
Top achievements
Rank 2
Answers by
Mira
Telerik team
Share this question
or