column header to span two columns in a datagrid display
Is it possible for a column header to span two columns?
If so how would this be done?
In the ItemDataBound (or ItemCreated) check if Item is of type Header and if so - define the colspan property of the Cell object which you want to define the Colspan for and delete the next Cell from hte DataGridItem
Is it possible to span header column in design view only. using some kind of CSS.
I'm using ASP,NET 3.5 and GridView...Making hyperlink on one column in datagrid from values in other column
I have columns in database:
id, homepage (stores url of persons hompage), name.
I want to display in datagrid in such a way that:
Only name as hyperlink (hyperlink value to be retrieved from id value, so that direct link will not be available) will appear in datagrid. So, that when user will click on hyperlinked email, it should get redirect to homepage url i.e.<a href=redirect.aspx?id=1>John></a>
Only john should appear in gridview and will be redirected to is homepage say www.xyz.com/john
If u mean, how to place the I...Adding a image in a column of datagrid depending upon the other column value
hi i have a dataset which returns few columns from a table, one of the let say "RTW" this column has combination of null and other values.now i am setting my datagrids datasource property to this dataset.upto here everything is fine, the problem is i have to add a column to the datagrid and display an image when the "RTW" column value is not null.for null values it shouldnt display anything.ThanksChandra
This should be fairly simple, all you need to do is wire up the ItemDataBound event of datagrid. Once you've done this make sure that e...Retrieving DataGrid Column values in Edit Mode with Hidden Column
Is it possible to retrieve the values from a DataGrid column while in Edit mode if the column is hidden?
I'd like to get these values in the Update event handler.
If this is possible could someone tell me how to do it?
You can get those values in several ways, but not directly from the datagrid. During the Update command you can do those things:
1. Look for the value in the associated dataset if you've used a dataset to bind to the grid.
2. Query the database for the current record and get the appropriate data right from the query result.
Ca...Datagrid Bound Column needs to be bound to 2 columns?a valu
I have a datagrid with dynamically bounded columns. One column has to display a value that will come from 2 columns in the database. Is there a way to do this?
the code I have for the moment is:
Dim col1 As New BoundColumn
col1.HeaderText = cLang.read("code")
col1.DataField = "Patient_Code" 'this needs to be 2 database columns!!
Combine the two columns in your SELECT statement eg
SELECT <PatientCol1>+<PatientCol2> AS Patient_Code FR...How to retrieve controls in column header of a DataGrid?
I have controls in column header of a my DataGrid control grdDocumentDate. I use grdDocumentDate.FindControl() to look for the controls in column header but could not get them. Is there any way to solve the problem?
ImageButton ib = (ImageButton)grdDocumentDate.FindControl("ibDocDate");ib always returns null.<asp:datagrid id="grdDocumentDate" style="Z-INDEX: 118; LEFT: 24px; POSITION: absolute; TOP: 176px" runat="server" BorderWidth="0px" AllowSorting="True" AutoGenerateColumns="False" OnItemCommand="ShowMoreDetailsCommand" BackColor="Silver" Width="704px"> ...When is a column not a column?
I have several extremely similar datawindows that I have to maintain that go
against the same table. Recently, I had to add a column to that table, and
also add the column to ALL of these datawindows that go against this table.
I added the column to the first datawindow, set up the edit control style,
etc. I then did a copy/paste of the columns edit control to the remaining
dw's (of course remembering to first add the column in SQL). Everything
(update props, column specs, column props) seems to indicate that the pasted
column is linked to the column I selected, HOWEVER, when I...How to place in DataGrids’s first column table’s column name, in second Datagrid’s column table’s column value?
Hello I use
C#. I’m interesting are there samples solved my problem.
You will need to loop through the datasource of the datagrid or through the datagrid items and fetch the values for the second datagrid.Sonu Kapoor [MVP] Feel free to ask me any .NET question | Ajax Data Controls Forum
Thank you! I solved my problem at the server cite.
...Setting Datagrid Column to invisible when Column is an AutoGeneratedColumn NOT a bound Column
Just like the title says, I'm trying to set a column to invisible but I'm unable to do so.
If I bound the column I can used the code:
me.datagrid.Column.Item(1).Visible = False
But since I'm wanting the column NOT to be bound (there are a number of sql scripts that populate the same datagrid so I cannot bound all the columns since the columns are different for each script etc etc etc) how do I set an AutoGeneratedColumn to invisible??
Been looking all over the place, but can't figure this one out yet:
I'm trying to put an image into a datagrid based on the value of a column. I.E. if the column's value is "1", show image 1; if "2", show image 2, etc. If the column's value is "1", I don't want to put an image there at all. On top of this, I need to attach an 'onclick' event to the cells with images.
When I converted my datagrid column to a template column, I was able to successfully add an html image and got the correct images to show and the onclick events to work. Unfortunately, a b...Can you control selectability of DataGrid column headers?
We have a DataTable with sorting enabled. The person that I am working for has a complaint: he wants the user to be able to select a column for sorting whenever the mouse is over the text in the header text of the column; as things stand now, the cursor must be positioned just below the text before the browser will allow selection. Is there a way to control this, or is this functionality that is internal to the browser?
This behavior appears to only be an issue in Internet Explorer, not Firefox.
the sort headers are simply an anchor...Get the column value from a DataGrid
Hi,I have a datagrid with 6 columns. I am trying to retrieve the value of a column and pass it to a variable. I am not sure what I doing wrong here since the code I am using is not pulling any value from the column. This is an example of what I am trying to do. Dim column_value As Stringcolumn_value = DataGrid1.Items(0).Cells.Item(4).Text Please correct me if I am wrong. Thanks.
Use a GridView control instea...Changing Datagrid Header based on column value
I am trying to change the header text of a column based on the values in the rows them selves.
Basically if and of the values in the columns are 0 I want to change the text of the header. I was trying to do this during the databound event, but the problems I was having was that I could not access the headertext of the column from the DataGridItemEventArg parameter.
I did get access to the Grid itself (they nested in a repeater btw) by accessing e.Item.Parent.Parent, but changes to the HeaderText were not displayed.
Any help would be appreciated, Thanks
Show the relevant code ...Using Headers spannig multiple columns & aspbound columns together in the same datagrid
I am trying to format a datagrid to display my data. I have some headers that span multiple columns. I was able to implement this using the following code structure.
<td rowspan="2" colspan="1" width="40%">Model</td>
<td rowspan="1" colspan="4">Sales</td>
<td rowspan="2" colspan="1">Distribution</td>
<td rowspan="2" colspan="1"...