Get Input Controls Name And Value In HTML Page


/ Published in: C#
Save to your folder(s)

Everything is either true or untrue, or both true and untrue, or neither true nor untrue - nagarguna


Copy this code and paste it in your HTML
  1. public static string GetInputControlsNameAndValueInPage(string strPage)
  2. {
  3. string strRegExPatten = "<\\s*input.*?name\\s*=\\s*\"(?<Name>.*?)\".*?value\\s*=\\s*\"(?<Value>.*?)\".*?>";
  4. Regex reg = new Regex(strRegExPatten, RegexOptions.Multiline);
  5. MatchCollection mc = reg.Matches(strPage);
  6. string strTemp = string.Empty;
  7. foreach (Match m in mc)
  8. {
  9. strTemp = strTemp + m.Groups["Name"].Value + "=" + m.Groups["Value"].Value + "&";
  10. }
  11. int n = strTemp.Length;
  12. strTemp = strTemp.Remove(n - 1);
  13. return strTemp;
  14. }

URL: ideabubbling.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.