ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Add id to every single row of grid?
Title:
B
I
{code}
?
How can I add unique Ids to every rows of a grid ? I want to insert html id into every tr tag
Save Changes
Cancel
CuLacGionTan
asked at 01 Jun 2015
Answers
B
I
{code}
?
you can set a Key for the GridModelBuilder, like this: new GridModelBuilder<Lunch>(list, g) { Key = "Id" ... and each row (tr tag) will get a data-k="id" attribute, can be selected with jquery like this $([data-k="id"]) having the key defined you can also use the api.select to select the row, rows in case of tree grid http://aspnetawesome.com/learn/mvc/Grid#Api if you still need an id attribute you could handle the grid 'aweload' event and go through each row, copy the value of data-k and put it into id
Save Changes
Cancel
Omu
answered at 02 Jun 2015
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK