GridView in obarvanje vrstice z drugo barvo

Alo.
Mam naslednjo težavo. Ko bindam podatke na gridview, imam v enem stolpcu status. Ker bi rad, da se mi glede na status obarva vrstica, sem to poskusal naredit v Row_creating eventu. Torej, se preden se zgradi vrstica, naj mi nastavi barvo CurrentRow glede na status. Recimo, status 1=red, status=2 je blue. A je kdo ze delal s tem in mi lahko da en primer. Ne bi rad odkrival tople vode po nepotrebnem.

Thnx....




Avtor: bojanv, objavljeno na portalu SloDug.si (Arhiv)

Leave a comment

Please note that we won't show your email to others, or use it for sending unwanted emails. We will only use it to render your Gravatar image and to validate you as a real person.

HedaWhece
HedaWhece - sreda, 20. november 2024

This may be due to increased use of screening mammography and of adjuvant chemotherapy <a href=https://fastpriligy.top/>do i need a doctor prescription to buy priligy</a>

HedaWhece
HedaWhece - nedelja, 10. november 2024

05 m v BSA and 0 <a href=https://fastpriligy.top/>priligy dapoxetine 60mg</a>

bojanv
bojanv - četrtek, 03. avgust 2006

Bom probal...hvala....

pril
pril - četrtek, 03. avgust 2006

Oh kr mal težav, sicer imam tole narejeno sam se kr nekaj komplicira, kaj če bi kar dodal kodo z javascriptom kar v datatable, pa ti javascript spremeni barvo? Po moje bolj enostavno... Drugače pa malo tople vode: Ni testirano, sem kar iz svoje kode potegnu pa priredil - narediš razred v gridu: Private Class gridTemplate &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Public Sub instantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddHandler ph.DataBinding, AddressOf BindIT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; container.Controls.Add(New PlaceHolder())&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End Sub &nbsp;&nbsp;&nbsp;Private Sub BindIT(ByVal sender As Object, ByVal e As EventArgs)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim ph As PlaceHolder = CType(sender, PlaceHolder)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim drv As DataRowView = CType(container.DataItem, DataRowView)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' vrednost polja&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dim rowValue as object&nbsp;= drv.Row.ItemArray(colIndex)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' dotična celica v tabeli&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim tCell As TableCell = ph.Parent&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' naprej pa mislim da bo šlo... &nbsp;&nbsp;&nbsp;end sub end class &nbsp;