Click here to Skip to main content
15,888,221 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public void Paging()
    {
        ds =(DataSet)Session["Table"];

        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            ViewState["test"] = i;
            lblsub.Text = subjectname;
            LinkButton lnk = new LinkButton();
            lnk.ID = i.ToString();
            lnk.Text = (i + 1).ToString();
            pnl.Controls.Add(lnk);
            lnk.Click += new EventHandler(lnk_Click);
            if (i == 0)
            {
                lnk.Visible = true;
            }
            else
            {
                lnk.Visible = false;
            }
        }
    }
    public void pagedisplay()
    {
        for (int i = 1; i <= pagecount; i++)
        {
            int pagecountg = i - 1;
            string page = pagecountg.ToString();
            LinkButton lbb = (LinkButton)pnl.FindControl(page);
            lbb.Visible = true;
        }
    }
Posted
Updated 18-Jan-13 19:26pm
v2
Comments
Mitchell J. 19-Jan-13 0:55am    
What sort of spaces?

Use CSS, margins or padding. Please see:
http://www.w3schools.com/css/css_boxmodel.asp[^],
http://www.w3.org/TR/CSS2/box.html[^].

The schema on the first of the pages referenced above shows you all the "spacing" involved in the style.

—SA
 
Share this answer
 
Can't you create the tables dynamically and put your linkbuttons into the table cell?
How about this:
C#
public void Paging()
{
    ds =(DataSet)Session["Table"];
    Table tbl = new Table();
    tbl.Width = Unit.Percentage(100);
    TableRow tblRow = new TableRow();
    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
    {
        ViewState["test"] = i;
        lblsub.Text = subjectname;
        LinkButton lnk = new LinkButton();
        lnk.ID = i.ToString();
        lnk.Text = (i + 1).ToString();
        TableCell tblCell = new TableCell();
        tblCell.Width = Unit.Percentage(25);
        tblCell.Controls.Add(lnk);
        tblRow.Controls.Add(tblCell);
        tbl.Rows.Add(tblRow);
        lnk.Click += new EventHandler(lnk_Click);
        if (i == 0)
        {
            lnk.Visible = true;
        }
        else
        {
            lnk.Visible = false;
        }
    }
    pnl.Controls.Add(tbl);
}

Use System.Web.UI.WebControls namespace.

--Amit
 
Share this answer
 
First write a cssclass in your stylesheet or document level

XML
<style type="text/css" >
    .space
    {
        margin-right:10px;
        font-size:10px;
        border:solid 1px silver;
    }


and before adding the controls to the panel add this line

lnkbtn.CssClass = "space";


and run..change the style as you required it works.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900