Advertisement

06.12.2008 at 03:50AM PDT, ID: 23478926
[x]
Attachment Details

how to include <br>tah in asp:table tag dynamically

Asked by sandyarani81 in .NET, Programming for ASP.NET

Tags: asp.net,c#

Here is my mode.I am adding usercontrol to asp:table tag dynamically.AI want to add br tag after each user controlhas been added to the table.User controls arr added to the table acccording to rows in databse table.How can i add break tag to table dynamically.I want space in between controls in table.Could you please suggest  me on this.

if (!Page.IsPostBack)
            {
               string mySql = "select * from Questions";
                DataView dv = new DbCon().GetDataView(mySql);
                DataRowView drv;
                for (int i = 0; i < dv.Count; i++)
                {
                    TableRow row = new TableRow();
                    TableCell cell = new TableCell();
                    drv = dv[i];
                   DotNetGraph graph = (DotNetGraph)Page.LoadControl("~/DotNetGraph.ascx");
                    //uc1 = (Control)tabel1.FindControl("dngchart" + i);
                    //lbl.Text = Convert.ToString(drv["ItemDescription"]);
                    graph.UserWidth = 200;
                    int agreeStrongly = Convert.ToInt32(drv["AgreeStrongly"]);
                    int agree = Convert.ToInt32(drv["Agree"]);
                    int neitherAgreeOrDisagree = Convert.ToInt32(drv["NeitherAgree or Disagree"]);
                    int disagree = Convert.ToInt32(drv["Disagree"]);
                    String[] sItems = new String[4];
                    Int32[] iValue = new Int32[4];

                    // Populate our variables
                    sItems[0] = "Agree Strongely";
                    iValue[0] = agreeStrongly;

                    sItems[1] = "Agree";
                    iValue[1] = agree;

                    sItems[2] = "Neither Agree or Disagree";
                    iValue[2] = neitherAgreeOrDisagree;

                    sItems[3] = "Disagree";
                    iValue[3] = disagree;


                    // Set our axis values

                    graph.YAxisValues = iValue;

                    // Set our axis strings
                    graph.YAxisItems = sItems;

                    // Provide a title
                    string description = Convert.ToString(drv["Description"]);
                    graph.ChartTitle = "<b>" + "<font size=4 color=purple>" + description + "</font>" + "</b>";

                    // Provide an title for the X-Axis
                    graph.XAxisTitle = "(units display actual numbers)";
                    cell.Controls.Add(graph);
                    row.Controls.Add(cell);
                    AuditTable.Controls.Add(row);

                    Control c1 ="<br/>";
                    TableRow row1 = new TableRow();
                    TableCell cell1 = new TableCell();
                    cell1.Controls.Add(c1);
                    row1.Controls.Add(cell1);
                    AuditTable.Controls.Add(row1);
                   
                }
            }
if i insert br like that i am getting error like cannot convert string to control
Start Free Trial
[+][-]06.12.2008 at 04:02AM PDT, ID: 21768061

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .NET, Programming for ASP.NET
Tags: asp.net,c#
Sign Up Now!
Solution Provided By: TimCottee
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628