473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Can a (windows) datagrid column contain different types of control

I want to have a datagrid, say 10 rows, and in one of the columns I want 7 of
the rows to have plain text, and the other 3 rows to have a combobox (or
linkbutton, etc). Is this even possible?

I have been reading various articles about how to derive a
DataGridTextBoxColumn to put a combobox in the cell, and it's not working too
well for me. Even if it does sort of work, the combobox is only visible if
I'm editing the cell. But I want it to stay visible all the time. I'm not
really going to be "editing" anything with the datagrid, but I'll just be
responding to events when you change the combobox or click on a link in the
cell. How do I do this? Thanks.
Sep 5 '05 #1
3 1844
Use a template column , add combobox to it,

and bind the control in an ItemDataBound Eventhandler method

which handles DataGrid1.ItemDataBound

DataGrid1_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType.Equals( ListItemType.Item)
|| e.Item.ItemType.Equals(ListItemType.AlternatingIte m))
{
ComboBox cbox = e.Item.FindControl("idOfComboBoxInDataGridTemplate Column")
as ComboBox

// Bind Combobox here

}

}

"MarkDu" wrote:
I want to have a datagrid, say 10 rows, and in one of the columns I want 7 of
the rows to have plain text, and the other 3 rows to have a combobox (or
linkbutton, etc). Is this even possible?

I have been reading various articles about how to derive a
DataGridTextBoxColumn to put a combobox in the cell, and it's not working too
well for me. Even if it does sort of work, the combobox is only visible if
I'm editing the cell. But I want it to stay visible all the time. I'm not
really going to be "editing" anything with the datagrid, but I'll just be
responding to events when you change the combobox or click on a link in the
cell. How do I do this? Thanks.

Sep 5 '05 #2
Andreas, that sounds like a web datagrid. In a web datagrid, I think it
would be doable. But can I do it in a windows datagrid?
Sep 5 '05 #3
Mark,

Have a look at our website and than this link, there is as well another
implementation. Know that in the Net 2.0 datagridview what the combobox and
other controls are standard implemented.

http://www.windowsformsdatagridhelp....d-faf92f41f563

I hope this helps,

Cor
Sep 5 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: exBK | last post by:
In a datagrid on a webform, I display item_id, item_type, and item_description. My item_types are numeric values ranging from 1-4. What I would like to do is, for each item_type, I would like to...
1
by: Lalit Bhatia | last post by:
how can we fix first column in DataGrid? Regards, Lalit Bhatia
9
by: Paul | last post by:
Hi I have a data grid with a hyperlink column. the colum has numbers like 00001,000002, ect. Just wondering how to get the text value of the cell as tempstring =...
1
by: mimi | last post by:
I need 2 different view on spending report for accounting and user. To accomplish it, I create 2 aspx page AccRpt and UserRpt. I created a web user control called summary.ascx. In the control,...
3
by: MarkDu | last post by:
I want to have a datagrid, say 10 rows, and in one of the columns I want 7 of the rows to have plain text, and the other 3 rows to have a combobox (or linkbutton, etc). Is this even possible? I...
3
by: Chris Paul | last post by:
I'm having trouble with PHP & PostgreSQL/OpenLDAP/Apache on Windows. I've set this up countless times on BSD (piece of cake) but I'm trying to do this on Windows now so that my developer can work...
0
by: Sridhar | last post by:
Hi, I have a datagrid which contains some bound columns, some template columns. The template columns contain text box in one column, Hyperlink column in other column, dropdownlist in another...
8
by: =?Utf-8?B?bWlrZWc=?= | last post by:
Hi, I am building a small Help Desk application for my company and need to be able to edit "open" help desk issues. I use a simple datagrid to display each issue (6 per page) , with an Edit...
6
by: josequinonesii | last post by:
I've searched, I've read, I've tested and re-read numerous post but to no avail yet... Quite simply, the settings I've applied to my httpd.conf, httpd-vhost.conf and my hosts files simply does not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.