Add GridViewDropDown Column telerik gridView in asp.net - c#

Is there a way to add GridDropDownColumn in asp.NET . I have a telerik GRIDVIEW and i want to add a DropdownColumn in GridView . I am trying to do something like this but DataSource there is not a valid property .
Is there any way like this too add GridDropDownColumn from codebehind in asp.net
((GridDropDownColumn)this.radGridView2.Columns[2]).DataSource = new String[] { "Block", "Active" };

Yes you can do this.
If you have generated drop down column using template field then on row bound event you can bind every drop down there.
Follow below steps.
1) generate Row Bound Event of rad grid
2) find template column and the control
3) Bind data source
Just complete step one by one and ALL SET

Related

How to add new line of row in devexpress gridcontrol?(WinForms C#)

I want to add a new line of row when pressing a button. In datagridview it would be:
datagridview1.Rows.Add()
What is the equivalent code for that in gridcontrol? Please help me.
You cannot add a new row directly to your GridControl, since this is just a container for the views. However, if you're using a GridView inside your GridControl (or any other descendant of ColumnView), you can add a new row using AddNewRow() method.
(myGridcontrol.MainView as DevExpress.XtraGrid.Views.Grid.GridView).AddNewRow();
Link to documentation
EDIT: You can access your view in a different way, of course.
The DevExpress GridControl must always be bound to a datasource: you cannot add rows directly to the GridControl object or its child GridViews.
Instead, you must bind your GridControl to a data source (via the GridControl.DataSource property), and add/remove rows via this data source.
See the 'Binding To Data' documentation at the DevExpress site for more information on the kinds of data sources that can be used with a GridControl.
You can use AddNewRow to add new row and SetRowCellValue to insert value to that row.
yourgridViewName.AddNewRow();
yourgridViewName.SetRowCellValue(rowhandle,columnName,value);
gridViewMappedFileds.UpdateCurrentRow();
Put yourgridName.RowCount-1 for rowhandle to insert the row at last.Put gridViewMappedFileds.Columns["ColumnName"] to give your columnname.

ASP.net Array List as a data source for Gridview

I am working with an asp.net grid view and i have used an array list of objects as a data source for this gridview.
every thing is ok but I faced some problems when i want to work on this gridview,
I want to to do the following:
Hiding a column
Change the column header text
Add a button to the gridview row and pass a value from the row to another page
thx in advance.
Hiding a column: are you using autogenerate columns? or did you add your own columns to the grid?
Change the column header text: open the grid columns editor (the little > icon on the upper right corner when you select the gridview)
Add a command column from the grid columns editor (step 2 above)
HTH
Jafar

How to get value of a particular cell in gridview i and pass it to db as a parameter in c#?

i m using C#, i am having problem in retrieving value of particular cell in gridview. the scenario is, there is a list of jobs shown in my grid. Coloumns are job_id, and job_title. I am populating my grid from database, so the grid shows a list of jobs available. and client can click on job_title, which is a hyperlink (
you can use DataKeys Property
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.datakeys.aspx
You can embedd job_id in hyperlink - hyperlink can be part of you database (one extra column) or created when you are populating your grid with data from database.

GridView Add TextBox TemplateField Into Footer CodeBehind

Suppose I have one template field
TemplateField FooterField = new TemplateField();
FooterField.ItemTemplate = //my code (basically setting it to display a button)
I then define what the FooterField should do during gridview editing mode like this:
FooterField.EditItemTemplate = //my code (entering editing mode when the button is clicked)
Now my question is: how can I insert this TemplateField into the gridview Footer?
You need to add your template field to GridView columns - each data control field essentially decides what is the contents for that column for header, footer and data rows. Grid-view being a table, you cannot have a field in footer without having column for it.
If your requirement is to have some UI (which is not columnar in nature) in the footer then you can inherit from GridView and override CreateRow method to substitute your own UI for a footer row. However, instead of going this route, I would rather design a user control that would probably show edit UI by capturing grid-view edit event - for example, you may use Grid-View and DetailsView together.

Adding textbox value into grid at runtime

I have two textboxes and I want to display their value in a grid.
When I click on the Add button, I want to create a grid dynamically at runtime. I also want to add the textbox values into the grid repeatedly when I want to display it.
ok... As per what you have said you want to create a dynamic grid and and you would like to add Values inside the textbox control inside the gridview? is my understanding is correct ?
check this link out : http://praveensunsetpoint.wordpress.com/2008/05/09/dynamic-gridvieweditdeleteinsertselect-just-copy-paste-and-enjoy-it/

Categories