473,245 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,245 software developers and data experts.

how to align control in palceholder control

Dear All,
I am making web application using Asp.net C#(Visual Studio2005).
I have checkboxlist(which is populated by all the master filed like category , subcategory ,customer , etc ). Now based on selection I generates web control label (to name the field) and dropdownlistbox (which is filled by code and its description).

My problem is all controls comes one after other. I would like label then dropdownlist in a single line. That custlabel and its dropdownlist comes in one line then next say categorylabel and its dropdownlistbox should align in next line and inbetween them one free line .

My code is
Expand|Select|Wrap|Line Numbers
  1.   foreach (ListItem li in CheckBoxListmst.Items)
  2.         {
  3.             if (li.Selected == true)
  4.             {
  5.                 //code added to fetch dropdownlist
  6.                 setting =               ConfigurationManager.ConnectionStrings["StyleSearchConnectionString"];
  7.                 if (setting != null)
  8.                 {
  9.                     conn = new SqlConnection(setting.ConnectionString);
  10.                     cmd = new SqlCommand("Search_display");
  11.                     cmd.CommandType = CommandType.StoredProcedure;
  12.                     cmd.Parameters.Add("@cateid", SqlDbType.VarChar);
  13.                     cmd.Parameters["@cateid"].Value = li.Text.ToString();
  14.  
  15.                     conn.Open();
  16.                     cmd.Connection = conn;
  17.                     try
  18.                     {
  19.                         // added controls
  20.                         Label label = new Label();
  21.                         DropDownList dropdownlist = new DropDownList();
  22.                         label.ID = "label" + li.Text;
  23.                         dropdownlist.ID = "dropdownlist" + li.Text;
  24.                         label.Text = li.Text;
  25.                         rdr = cmd.ExecuteReader();
  26.                         while (rdr.Read())
  27.                         {
  28.                             ListItem ld = new ListItem();
  29.  
  30.                             ld.Text = rdr["disp"].ToString();
  31.                             ld.Value = rdr["mstid"].ToString();
  32.                             dropdownlist.Items.Add(ld);
  33.  
  34.  
  35.                         }
  36.                         PlaceHolder1.Controls.Add(label);
  37.                         PlaceHolder1.Controls.Add(dropdownlist);
  38.  
  39.  
  40.                         Response.Write("<BR >");
  41.                         //added controls end
  42.  
  43.                     }
  44.  
  45.                     catch (SqlException ex)
  46.                     {
  47.                     }
  48.  
  49.  
Please Guide me or atleast give some help full link.
thanks
Jul 23 '07 #1
1 1582
Frinavale
9,735 Expert Mod 8TB
Dear All,
I am making web application using Asp.net C#(Visual Studio2005).
I have checkboxlist(which is populated by all the master filed like category , subcategory ,customer , etc ). Now based on selection I generates web control label (to name the field) and dropdownlistbox (which is filled by code and its description).

My problem is all controls comes one after other. I would like label then dropdownlist in a single line. That custlabel and its dropdownlist comes in one line then next say categorylabel and its dropdownlistbox should align in next line and inbetween them one free line .

My code is ...
Please Guide me or atleast give some help full link.
thanks
Most asp.net controls have a CssClass property. When you create the DropDownList or Label or other web control, you can assign the control a CssClass.

All you have to do is create the CSS file, add the class that outlines how the control should be displayed, reference the CSS file in your aspx page, and assign the controls the appropriate class.

I'd look into how to use CSS.

-Frinny
Jul 23 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Mikko Rantalainen | last post by:
See example at <URL:http://www.cc.jyu.fi/~mira/moz/formtest.php>. The problem is that the label of submit button is always centered on the button regardsless of 'text-align' property in CSS....
2
by: Kay | last post by:
Hello, I have a asp lable control, which I use to display text in, I would like to have the text display aligned in the center and vertical alignment left however when I add the following style...
3
by: VB Programmer | last post by:
I cant 'align center' a text box. First of all, all the justifications (left, center, right) on the toolbar are dimmed. Why? Also, when I try to do it through HTML (wrapping the control in a...
2
by: Jim McGivney | last post by:
I would like to center align the text in an asp label control. Surely this is possible, I can't find the proper syntax in the documentation. Any help is appreciated. Jim
14
by: artifact.one | last post by:
It'd be really pleasant (in my opinion) if the next revision of the C language actually allowed some portable control over data alignment. Compiler-specific mechanisms for this stuff are so...
2
by: swapna_munukoti | last post by:
Hi all, I am new to asp.net. So, may be my question may be simple. But I am feeling hard to achieve this. I need to create a web custom label control, for which I have to assign new property...
1
by: ShayHk | last post by:
on windows form application , when I drag a button to the form... The button declaration is created above on the code + it's properties on Visual studio 2005 Web application I draged a button to...
40
by: maya | last post by:
hi, how do I get text to vertical-align inside a div? http://www.mayacove.com/misc/home.html vertical-align should work, according to this:...
13
by: Stevo | last post by:
I've found that for IE6+, if you add the property text-align:center to a DIV, then *anything* inside it gets centered. That can be a table, an object/embed, another DIV, an image, or some text. ...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.