By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 744 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

How to add pager control for Composite Control.

P: n/a
Hi,

I am unable to add a pager for this composite control.

I had created a composite control in C#. The control is having 5 labels, one radio button and one DropDownList control. The composite control should display 2 columns and 2 rows per page. I am able to display 4 Composite Controls independently, when the user is changing the index of the DropDownList control, automatcially the output should get reflected on the composite control itself.

The source code for the above:

// Start Creating Meter Controls max 4

try
{
int j=0;
HtmlTableCell tblCell;
HtmlTableRow tr;
IList iMeterId = mc.GetAllMeterId(Convert.ToInt32(Session["UserId"]));

if(iMeterId.Count == 0)
{
tr = new HtmlTableRow();
tblCell = new HtmlTableCell();
tblMeter.BgColor = "lightsteelblue";
tblCell.VAlign = "top";
tblCell.InnerHtml = "<label class='errorLabel'>There are no meters found.</label>";
tr.Cells.Add(tblCell);
tblMeter.Rows.Add(tr);
bAfterLoad=false;
}
else
{
for(int k=0;k<iMeterId.Count;)
{
tr = new HtmlTableRow();
if(k>=4)
{
break;
}

for(int i=0;i<2;i++)
{
if(j==iMeterId.Count)
{
break;
}
//Creating Cell
tblCell = new HtmlTableCell();
tblCell.Width = "33%";
tblCell.VAlign = "top";
meter = (MeterControl) Page.LoadControl("MeterControl.ascx");
meter.MeterId = Convert.ToInt32(iMeterId[j]);
meter.OptMeterId = Convert.ToInt32(iMeterId[j]);
meter.ID = "MeterId" + (i+k);
tblCell.Controls.Add(meter);
tr.Cells.Add(tblCell);

tblCell = null;
meter = null;
j++;
}
k+=2;
tblMeter.Rows.Add(tr);
}
bAfterLoad=true;
}
catch{}
Nov 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.