Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Retrieving user input
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Retrieving user input
Divers
Thread ID:
01231296
Message ID:
01231296
Vues:
58
I have a function that will loop through all of the controls on a web page and package up the data into xml.

I want to include the controls even if left blank. The following code does include blank text boxes, but not blank checkboxes. Any advice on how I can get the checkboxes to be included in my loop of controls?
static public String GetFormInputAsXML(String sRootNode)
{
    StringBuilder tmpS = new StringBuilder(10000);
    String nodename = String.Empty;
    tmpS.Append("<C2B><" + sRootNode + ">");
    for (int i = 0; i < HttpContext.Current.Request.Form.Count; i++)
    {
        nodename = HttpContext.Current.Request.Form.Keys[i].ToString();
        String nodeval = XmlCommon.XmlEncode(HttpContext.Current.Request.Form[HttpContext.Current.Request.Form.Keys[i]]);
        tmpS.Append("<" + nodename + ">");
        tmpS.Append(nodeval);
        tmpS.Append("</" + nodename + ">");
    }
    tmpS.Append("</" + sRootNode + "></C2B>");
    return tmpS.ToString();
}
Thank you,
Paul
Répondre
Fil
Voir

Click here to load this message in the networking platform