hello all,
I want to display a button in a cell of a WebGrid depending on the value of cell.
EX: if Cell.value=1 then
display button with image
i want to do this during runtime. And I don't want to display value of cell only button with image.
Is there any solution for this
Thanks
Shital
Hello,
Thanks for writing. I recently had a project the required that (finding a control inside UltraWebGrid TemplatedColumns dynamically with C) and here is what I ended up with:
<igtbl:TemplatedColumn> <CellTemplate> <asp:placeholder runat="server" ID="Placeholder1'> </CellTemplate></igtbl:TemplatedColumn>
and then in InitializeRow, you can do something similar to this (pseudo code, just for reference)
TemplatedColumn col = (TemplatedColumn)e.Row.Cells.FromKey("SomeKey").Column;CellItem ci = (CellItem)col.CellItems[e.Row.Index];Placeholder placeholder = (Placeholder) ci.FindControl("placeHolder1"); if (e.Row.Index == 1) placeholder.Controls.Add(new Label("Some Text 1"));else placeholder.Controls.Add(new TextBox("Some Text 2"));
In my case I am searching for placeholder, but in your case you can always search for the image and just cast to Image instead of Placeholder. More info on this topic can be found here:
http://forums.infragistics.com/forums/p/13647/50458.aspx#50458