0

I learned MVC first. I'm kinda completely lost on Web Forms and I can't find the way to do this simple task. I have this Telerik Radgrid filled with some information. You can see an example of what I'm trying to achieve here:

Table with Icons

As you can see, different icons are supposed to be shown based on different status under the "Estatus" column. The icons used are from here.

On MVC, I would (and maybe is not even the right approach) use AJAX with jQuery to fill the table and put an extra column, and the HTML on that column would be written based on the data under the "estatus" column. This table doesn't get filled using jQuery so I am stuck on how I should make these icons to appear based on some data.

Should I just use a Javascript function to add that column when the page loads? Is there a more elegant way?

A correct, yet, simple answer will be voted up quickly.

Thank you!!!

SamyCode
  • 928
  • 3
  • 14
  • 33
  • I forgot that I could just use a little inline C# block for this. Now the only question that remains is that, for example: To show the data in the grid, I would write something like this: <%# Item.CreateDate %> needing the # symbol and I don't find a way to write an if statement including the # symbol needed to show the data. Any thoughts? – SamyCode Jun 19 '17 at 22:24
  • How are you binding this grid, client side or server side? – Seano666 Jun 19 '17 at 22:29
  • @Seano666 I'm completely new to web forms so I'm sorry if I don't answer that question well. The control name is "gvReportLog" and I see a "gvReportLog.DataBind();" instruction in the code behind. I don't see anything about the datasource whatsoever. What I do know is that the data needed is accessed with the code: <%# Item.PropertyNameHere %> in the columns on the front end. It seems to be accessing properties of "item", but I don't see "item" declared nowhere. Damn I am really lost :( – SamyCode Jun 19 '17 at 23:06
  • OK, the reason I was asking is you can tap into each row after it's built in the "OnItemDataBound" server event. Then you can make changes to the icon depending on the data in the row. Here is a decent example https://stackoverflow.com/questions/9066572/retrieve-radgrid-cell-value-in-itemdatabound-input-string-was-not-in-a-correc – Seano666 Jun 20 '17 at 14:40
  • @Seano666 interesting. I found a way to do it via jQuery but I will definitely check this out. – SamyCode Jun 20 '17 at 22:38

0 Answers0