Get row id from Request.Form

Get row id from Request.Form

benoatenbenoaten Posts: 10Questions: 3Answers: 1

When submitting inline changes from the datatable, i get the data from the controller using HttpContext.Request.Form.

To get the value of the submitted field I loop through all keys and get the value from those keys using formData[currentKey]. My question is how to get the row ID from that key aswell as the value. For example
the key = "data[0001][TestColumn]"
formdata[key] gets the new value of TestColumn,
how do I get the row ID (0001)?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    It is an IEnumerable<KeyValuePair<string, string>> so you can use:

    foreach (var pair in dataIn)
    {
      // pair.Key
      // pair.Value
    }
    

    Allan

  • benoatenbenoaten Posts: 10Questions: 3Answers: 1

    Hi Allan, I'm a bit confused as to what you mean, HttpContext.Request.Form, HttpContext.Request.Form.AllKeys nor the individual keys within AllKeys are KeyValuePairs, what is dataIn in your example?

  • benoatenbenoaten Posts: 10Questions: 3Answers: 1
    Answer ✓

    This issue has been resolved!

Sign In or Register to comment.