Need help to built XML

Jun 13 2010 7:56 AM

So far i've as follow in my GridView
 string currentidx = null;            
            //Enumerate the GridViewRows
            for (int index = 0; index <= gv.Rows.Count - 1; index++)
            {
                //Programmatically access the CheckBox from the TemplateField
                CheckBox cb = (CheckBox)gv.Rows[index].FindControl("RowLevelCheckBox");
                //If it's checked, read it...
                if (cb.Checked)
                {
                    currentidx = gv.DataKeys[index].Value.ToString();
                    lblMsg.Text += string.Concat("<li>", currentidx, "</li>");
                }
            }
            lblMsg.Text += "</ul>";

So my result shown
  • 1
  • 2

how to adjust my code above, the my output will get it as follow
 

<data>
<ud><idx>1</idx></ud>
<ud><idx>2</idx></ud>
</data> 

 
Really need help

Answers (1)