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

How to add many textboxes in a grid code-behind

4 Answers 258 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Isabelle
Top achievements
Rank 1
Isabelle asked on 25 Feb 2016, 08:47 PM

Hi,

 

I can't find a solution to this : I want to create an order form with a grid abd 5 textbox by rows. In these textbox, the user will enter quantity and all the grid will be saved at the save button. So, i need to do this in code-behind. I have this code :

 

 MyGrid.DataSource = ds
 'Colon #0 > DescriptionNaviguateUrl
 mycolumn= New Telerik.Web.UI.GridBoundColumn
mycolumn.HeaderText = "DescriptionNaviguateUrl"
mycolumn.DataField = "DescriptionNaviguateUrl"
mycolumn.Visible = False
MyGrid.MasterTableView.Columns.Add(mycolumn)

'Column#1 >Model + COlor
mycolumn= New Telerik.Web.UI.GridBoundColumn
mycolumn.HeaderText = "Model #"
mycolumn.DataField = "Model"
mycolumn.Visible = False
MyGrid.MasterTableView.Columns.Add(mycolumn)

 

 

How can i add a texbox column in the same way?

 

Thanks!

4 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 26 Feb 2016, 02:59 PM
Hello Isabelle,

You can achieve this using Template columns:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/defining-structure/creating-a-radgrid-programmatically#creating-template-columns-programmatically

Alternatively, you can check the Batch editing provided by RadGrid:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx

I hope this will prove helpful.

Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Isabelle
Top achievements
Rank 1
answered on 26 Feb 2016, 06:39 PM
Thank you very much! Exactly what i want to do!
0
Isabelle
Top achievements
Rank 1
answered on 07 Mar 2016, 03:44 PM
Unfortunately, there is nothing that works for me. I would always add a column to my grid in which there will
a textbox that I can edit. All codes I find are in asp.net so I want to do everything in vb (code behind)

So this:


BoundColumn = New GridBoundColumn ()
         RadGrid1.MasterTableView.Columns.Add (BoundColumn)
         boundColumn.DataField = "## 1 addr"
         boundColumn.HeaderText = "Address"

         BoundColumn = New GridBoundColumn ()
         RadGrid1.MasterTableView.Columns.Add (BoundColumn)
         boundColumn.DataField = "state"
         boundColumn.HeaderText = "Province"

         BoundColumn = New GridBoundColumn ()
         RadGrid1.MasterTableView.Columns.Add (BoundColumn)
         boundColumn.DataField = "country"
         boundColumn.HeaderText = "Country"


But the next column will be the one to edit ....
0
Eyup
Telerik team
answered on 10 Mar 2016, 09:46 AM
Hi Isabelle,

You can achieve this requirement by creating programmatic GridTemplateColumn and within its ItemTemplate you can place a textbox control as demonstrated in the sample from the first link in my previous reply. However, since you will be creating the grid during Page_Init, "grid columns should be added to the Columns collection of the MasterTableView after their attributes are set.":
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/defining-structure/creating-a-radgrid-programmatically#creating-a-radgrid-on-page_init

Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Isabelle
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Isabelle
Top achievements
Rank 1
Share this question
or