Solved

Setting Z-index (Z-order in vb6) and position of control in ASP.NET

Posted on 2002-07-17
4
1,433 Views
Last Modified: 2008-01-09
dear guys,

i have used the asp.net to write my application, and i use the code-behind scenario.
i dunno how to set the textbox, image,.. and others contols in the "code-behind". i only can set the position in the front interface part (i use the grid layout).
this is bcos i want to do graphic drap-and-drop of some image control by clicking the button.

thanks you for whoever provide suggestion or opinion.
0
Comment
Question by:eng310
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 23

Expert Comment

by:naveenkohli
ID: 7162494
When you drop a control on the page, a variable corresponding to that control is added to codebehind file. the name of that variable will be the ID of the control that you set in the design view. To manipulate that control's appearance etc you can access the properties through the variabl. For example, If you drop a text box control on the aspx page...

** aspx file ***
<asp:TextBox ID="myTextBox" Runat="server"></asp:TextBox>

* in code behind file (C#) **

protected TextBox myTextBox;

private method ChangeTextBoxWidth()
{
 myTextBox.Size.Width = 30;
}

this is just an example on how you can modify the apeearance.
-------------------

If you want to add control dynanmically... then best would be to drop a PlaceholderControl on the page. Put it where you want your controls to appear. And then code behind, create a new instance of your control and add it to Controls collection to PlaceHoldercontrol.

Naveen
0
 

Author Comment

by:eng310
ID: 7164295
sorry,tq for u reply and comments. but i dun want to control the size.i want to change the position properties of the image control. but it is not avaible in "code-behind" of ASP.net. it is availabe only in windows form application
0
 
LVL 23

Accepted Solution

by:
naveenkohli earned 22 total points
ID: 7165698
You can modify the position of the control by adding the CSS style attribute.
for example to set the following attribute on text control...
style="Z-INDEX: 101; LEFT: 610px; POSITION: absolute; TOP: 831px"

Use the following code...

TextBox myBox = new TextBox();
myBox.Attributes.CssStyle("z-index", "101");
myBox.Attributes.CssStyle("LEFT", "610px");
myBox.Attributes.CssStyle("POSITION", "absolute");
myBox.Attributes.CssStyle("TOP", "831px");

Naveen


0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9416213
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by naveenkohli

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TheLearnedOne
EE Cleanup Volunteer
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question