Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Quick ItemDataBound (datagid cell hiding) help please

Thread Tools

Quick ItemDataBound (datagid cell hiding) help please

Posts: n/a
I was hoping someone could help me with an issue (using vb & .net 2.0)
I have a datagrid and the first column shown i have an asp:textbox
that i basically want to "group by" an ID and only want to show the
textbox for unique values.

the grid has a seriesID bound and invisible in the grid and i'm doing
an ItemDataBound function call on the grid, i spin thru the rows from
the dataset, if the first current row's ID doesn't match the previous,
i want to show the textbox. if it does match i want to hide the

in the code behind, i have a global variable defined:
Public prevSeriesID As Int64
(Int64 because the field in the db is BigInt).
that is initialized to -1 in the !postback in page_load

this is my ItemDataBound function:

Sub ItemDataBoundEventHandler(ByVal sender As Object, ByVal e
As DataGridItemEventArgs)

If e.Item.ItemType <> ListItemType.Header And
e.Item.ItemType <> ListItemType.Footer Then

Dim currSeriesID =
Convert.ToInt64(DataBinder.Eval(e.Item.DataItem, "SeriesID"))
lblMessage.Text = lblMessage.Text + _
" curr = " + Str(currSeriesID) + " prev = " +
Str(prevSeriesID) + "<br>"

If currSeriesID = prevSeriesID Then
lblMessage.Text = lblMessage.Text +
e.Item.BackColor = System.Drawing.Color.Yellow
End If
prevSeriesID = currSeriesID

End If
End Sub

the lblMessage is just for my debugging and is showing that the logic
is working correctly. also the changing of the background color to
yellow is working correctly, so the proper rows are being "affected"

I tried
e.Item.Visible = False, but that didn't do anything
e.Item.Cell.Visible = False, that didn't work either
e.Item.cells[0].RowSpan = 2, but that is an invalid line

can you tell me how to make that row cell containing the textbox
invisible or the correct syntax to alter the rowspan?

thank you very much for your reply.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
assign value to a cell referencing by column name in itemdatabound gane ASP .Net Datagrid Control 0 06-01-2006 03:48 PM
Quick Question Quick Answer JKop C++ 11 05-24-2004 09:46 PM
Quick Restore for a Compaq not so quick! Croos Bustamunky Computer Support 2 05-15-2004 04:17 AM
PanasonicBQ390 "quick" charger - How quick? Ol' Bab Digital Photography 1 01-17-2004 06:54 AM
please help... learn C++ please please please :) KK C++ 2 10-14-2003 02:08 PM