Sticky Posts in GridView

  • Thread starter Thread starter Uriah Piddle
  • Start date Start date
U

Uriah Piddle

Hi Gang,

I've given up looking and I am pretty sure it does not exist but I thought I
should do a post just in case I'm wrong: I am making an online forum in VS
2005 using the ASP GridView. I want to be able to make some posts 'Sticky'
and have them stay at the top of the grid no matter when they were created.
I am pretty sure I could do this procedurally in the C# module but I do not
want to loose everything I get by having a data bound control.

Does anyone know of some easy way to cause a row to stay in a group of rows
that always stays at the top?

Thanks,

Steve
 
Sure.
If you are going to use DataBinding, you need to put in some sort of code
that will ensure that your "Sticky" items are always the first N items in the
datasource.

So for example if you had a DataTable, you would have some code that does
InsertAt to insert these rows at the very beginning, then when you do your
databinding they will always be the first rows.
Peter
 
Peter,

I tried to find a property that allows me to position a row in the
RowCreated code block but couldn't. Then I realized that I could just put
the whole thing in the 'ORDER BY' SQL statement. Sometimes things are
simpler than they appear (famous last words).

Thanks.

Steve
 
Back
Top