protected void LinkButton1_Click(object sender, EventArgs e)
{
try
{
int index = 0;
LinkButton lb = (LinkButton)sender;
GridViewRow row = (GridViewRow)lb.NamingContainer;
if (row != null)
{
index = row.RowIndex;
}
Label labelID = (Label)GridViewNewsFeed.Rows[index].FindControl("HiddenFieldID");
HiddenField1.Value = labelID.Text;
SPWeb web = SPContext.Current.Web;
SPSiteDataQuery query = new SPSiteDataQuery();
query.Lists = "<Lists>" +
"<List ID=" + web.Lists.TryGetList("StaffNews").ID.ToString() + " />" +
"<List ID=" + web.Lists.TryGetList("CompanyNews").ID.ToString() + " />" +
"<List ID=" + web.Lists.TryGetList("ManagementNews").ID.ToString() + " />" +
"</Lists>";
query.Query = "<Where><Eq><FieldRef Name='ID' /><Value Type='Text'>" + labelID.Text + "</Value></Eq></Where>";
query.ViewFields = "<FieldRef Name=\"Title\" />" + "<FieldRef Name=\"Attachments\" />" +
"<FieldRef Name=\"Authors\" />" + "<FieldRef Name=\"Link\" />" +
"<FieldRef Name=\"Contents\" />" + "<FieldRef Name=\"Categories\" />" +
"<FieldRef Name=\"Date1\" Nullable=\"TRUE\"/>" + "<FieldRef Name=\"UniqueId\"/>";
query.Webs = "<Webs Scope=\"SiteCollection\" />";
query.RowLimit = 5;
DataTable dt = web.GetSiteData(query);
DataView dv = new DataView(dt);
DetailsView1.DataSource = dv;
DetailsView1.DataBind();
}
catch (Exception x)
{
Label1.Text = x.Message;
}
}
i cant get the unique id how should i solve this?