Quantcast
Channel: SharePoint 2010 - General Discussions and Questions forum
Viewing all articles
Browse latest Browse all 17574

Sharpoint list populate dropdownlist value field & Text Field using lists.asmx webservice

$
0
0

hi every one,

I want to populate the Sharepoint List Columns:

Title ----datatype=string-----------Datatextfield

Value----datatype=string----------Datavaluefield

i have populated the dropdownlist using lists.asmx GetListItems() method but the thing is i populated only one field  that is Value field.

i also want to get the TextField how to ?

  string strlistName = "{7AE8F178-B2B9-4A17-B20B-B30288AED935}";
                            //string strviewName = "";
                            string rowLimit = "500";
                            string strquery = "<OrderBy><FieldRef Name=\"ID\" Ascending=\"True\" /></OrderBy>";

                            WebListService.Lists objlists = new MySolution.WebListService.Lists();

                            objlists.Url = "http://myserver/_vti_bin/lists.asmx";
                            objlists.Credentials = System.Net.CredentialCache.DefaultCredentials;


                            // Instantiate an XmlDocument object
                            System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
                            System.Xml.XmlElement query = xmlDoc.CreateElement("Query");
                            System.Xml.XmlElement viewFields = xmlDoc.CreateElement("ViewFields");
                            System.Xml.XmlElement queryOptions = xmlDoc.CreateElement("QueryOptions");
                            /*Use CAML query*/
                            query.InnerXml = strquery;
                            viewFields.InnerXml = "";
                            queryOptions.InnerXml = strquery;

                            XmlNode listNode = objlists.GetListItems(strlistName, null, query, null, rowLimit, null, null);


                          


 foreach (System.Xml.XmlNode node in listNode)
 {
  if (node.Name == "rs:data")
   {
     for (int i = 0; i < node.ChildNodes.Count; i++)
    {
      if (node.ChildNodes[i].Name == "z:row")
      {


          ddl.Items.Add(node.ChildNodes[i].Attributes["ows_Value"].Value);



      }
            }
        }
    }

MySolution is my project name

WebListService is the Web Reference name

Thanks & Regards


sal


Viewing all articles
Browse latest Browse all 17574

Trending Articles