KavyaVS
asked on
ListView PageProperties Changing Event
This is my code
protected void secondListView_PagePropert iesChangin g(object sender, PagePropertiesChangingEven tArgs e)
{
DataPager pager =
(DataPager)((ListView)send er).FindCo ntrol("Ite mDataPager ");
pager.SetPageProperties(e. StartRowIn dex, e.MaximumRows, false);
DataTable dtHistory =GetReportHistory(strChild Node);
DataView dataView = new DataView(dtHistory);
dataView.Sort = "HistoryID DESC";
secondListView.DataSource = dataView;
secondListView.DataBind();
foreach (ListViewDataItem item in secondListView.Items)
{
DataKey currentDataKey
=secondListView.DataKeys[i tem.DataIt emIndex];
LinkButton btnlink = (LinkButton)item.FindContr ol("lnkSel ect");
btnlink.OnClientClick =
"window.open('Report_Form. aspx?Repor tpath=" + strCNode + "&SnapshotID=" +
currentDataKey.Value.ToStr ing() +
"',null,'height=1000, width=1000,status= no,resizable= yes, scrollbars=yes, toolbar=no,location=no,men ubar=no ');return false";
}
}
Here I am getting the index out of range exception.
DataKey currentDataKey =secondListView.DataKeys[i tem.DataIt emIndex];
Can I use something like this
for (int j = 0; j>=e.startRowIndex; j++)
{
ListViewItem item = (ListViewItem)this.secondL istView.It ems;
DataKey currentDataKey =secondListView.DataKeys[i tem[j].Dat aItemIndex ];
LinkButton btnlink = (LinkButton)item.FindContr ol("lnkSel ect");
btnlink.OnClientClick =
"window.open('Report_Form. aspx?Repor tpath=" + strCNode + "&SnapshotID=" +
currentDataKey.Value.ToStr ing() +
"',null,'height=1000, width=1000,status= no,resizable= yes, scrollbars=yes, toolbar=no,location=no,men ubar=no ');return false";
}
I am getting this error.Cannot apply indexing with [] to an expression of type 'System.Web.UI.WebControls .ListViewI tem'.
Please let me know how to fix the index out of range exception after Data Paging. How to add button onclient click event to LinkButton after paging.
Thanks
protected void secondListView_PagePropert
{
DataPager pager =
(DataPager)((ListView)send
pager.SetPageProperties(e.
DataTable dtHistory =GetReportHistory(strChild
DataView dataView = new DataView(dtHistory);
dataView.Sort = "HistoryID DESC";
secondListView.DataSource = dataView;
secondListView.DataBind();
foreach (ListViewDataItem item in secondListView.Items)
{
DataKey currentDataKey
=secondListView.DataKeys[i
LinkButton btnlink = (LinkButton)item.FindContr
btnlink.OnClientClick =
"window.open('Report_Form.
currentDataKey.Value.ToStr
"',null,'height=1000, width=1000,status= no,resizable= yes, scrollbars=yes, toolbar=no,location=no,men
}
}
Here I am getting the index out of range exception.
DataKey currentDataKey =secondListView.DataKeys[i
Can I use something like this
for (int j = 0; j>=e.startRowIndex; j++)
{
ListViewItem item = (ListViewItem)this.secondL
DataKey currentDataKey =secondListView.DataKeys[i
LinkButton btnlink = (LinkButton)item.FindContr
btnlink.OnClientClick =
"window.open('Report_Form.
currentDataKey.Value.ToStr
"',null,'height=1000, width=1000,status= no,resizable= yes, scrollbars=yes, toolbar=no,location=no,men
}
I am getting this error.Cannot apply indexing with [] to an expression of type 'System.Web.UI.WebControls
Please let me know how to fix the index out of range exception after Data Paging. How to add button onclient click event to LinkButton after paging.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER