This is a migrated thread and some comments may be shown as answers.

How to set a row (<tr/>) attribute with MVC Grid?

2 Answers 178 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Edoardo
Top achievements
Rank 1
Edoardo asked on 11 Mar 2011, 04:42 PM
Hello,

i would like to be able to set a row attribute with MVC WebGrid based on the databound collection row item (i.e.: <tr id='@item.id' ...). Is that possible? How?

2 Answers, 1 is accepted

Sort by
0
Saul
Top achievements
Rank 1
answered on 19 May 2011, 04:56 PM
Did you figure out how to do this? I tried using setting  row.HtmlAttributes["id"] in RowAction but nothing happened. Any ideas?
0
Ivan
Top achievements
Rank 1
answered on 20 Jul 2011, 09:37 PM
Hey this is what I did:

 .RowAction(row =>
              {
                   row.HtmlAttributes["id"] = row.DataItem.ComplaintId;
              })

HTH!
Tags
Grid
Asked by
Edoardo
Top achievements
Rank 1
Answers by
Saul
Top achievements
Rank 1
Ivan
Top achievements
Rank 1
Share this question
or