0

I am trying to get the Values from two Lists what have i dont wrong? i dont get any errors the site is only updating nothing more just like it dont fel that i press the button

protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {

            if (DropDownListFeeds.SelectedValue=="0")
            {
                SPWeb web = SPContext.Current.Web;

                SPSiteDataQuery query = new SPSiteDataQuery();
                query.Lists =
                    "<Lists><List ID=\"98B914FA%2DA714-44DB-9A44%2D80ADE288F18E\"/><List ID=\"D1E0691B-33E3%2D49EF%2DA0B9-F96C1F166AFD\"/></Lists>";

                query.Query =
                    string.Format("<OrderBy><FieldRef Name='Modified' Ascending='FALSE'></FieldRef></OrderBy>");
                query.Webs = "<Webs Scope=\"SiteCollection\" />";

                query.RowLimit = 10;


                DataTable dataTable = web.GetSiteData(query);





                Repeater2.DataSource = dataTable;

                Repeater2.DataBind();


            }

        }
        catch (Exception x)
        {

            Label1.Text = x.Message;
        }

2 Answers 2

1

MS Documentation has it as

query.Webs = "<Webs Scope=\"SiteCollection\" />";

Instead of:

query.Webs = "<Webs Scope=\"SiteCollection\">";

Not sure if that is what is blowing up your code though. As mentioned above the ID's do look off.

0

You List IDs are not looking right, Here's an example of how it should be like,

<Lists>
  <List ID="7A9FDBE6-0841-430a-8D9A-53355801B5D5" />
  <List ID="3D18F506-FCA1-451e-B645-2D720DC84FD8" />
</Lists>

Source

If after fixing it, it still doesn't work then try to debug it and find where exactly its getting error.

Hope it helps.

1
  • i know wrote it wrong but i dont get Any error Messages i have debugged
    – Batistuta
    Commented Jan 29, 2013 at 23:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.