473,388 Members | 1,355 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,388 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 1588
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.