473,408 Members | 2,813 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,408 software developers and data experts.

Retrieve a Panel's style attributes

Hi all,

How can I read through the style attributes for a server control? It would
be so convenient if one could reference an index, something like:
pnlPageHeader.Style.Keys["Top"].ToString();

TIA,

John
Nov 18 '05 #1
3 1617
Well, you can get an enumerator on Keys and iterate through. This sample is
from MSDN:

<html>
<script language="C#" runat="server">
void Page_Load(Object Src, EventArgs e) {
Message.InnerHtml += "<h5>The Text Box's CssStyleCollection
contains:</h5>";

IEnumerator keys = MyText.Style.Keys.GetEnumerator();

while (keys.MoveNext()) {

String key = (String)keys.Current;
Message.InnerHtml += key + "=" + MyText.Style[key] + "<br>";
}
}
</script>
<body>
<span id="Message" MaintainState="false" runat="server" />
<p>
<b>Enter some text:</b> <br>
<input id="MyText" type="text" value="Type a value here."
style="font: 14pt verdana;width:300;" runat="server"/>

</body>
</html>
--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"John Spiegel" <js******@YETANOTHERSPAMHATERc-comld.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi all,

How can I read through the style attributes for a server control? It
would
be so convenient if one could reference an index, something like:
pnlPageHeader.Style.Keys["Top"].ToString();

TIA,

John

Nov 18 '05 #2
"John Spiegel" <js******@YETANOTHERSPAMHATERc-comld.com> wrote in message news:<#j**************@TK2MSFTNGP09.phx.gbl>...
Hi all,

How can I read through the style attributes for a server control? It would
be so convenient if one could reference an index, something like:
pnlPageHeader.Style.Keys["Top"].ToString();

TIA,

John


pnlPageHeader.Style["Top"] = "5";
Response.Write(pnlPageHeader.Style["Top"]);
Nov 18 '05 #3
Thanks, Chris and Shahar!

Once I remembered case-sensitivity, the ["TOP"] indexing worked quite well!

- John

"John Spiegel" <js******@YETANOTHERSPAMHATERc-comld.com> wrote in message
news:#j**************@TK2MSFTNGP09.phx.gbl...
Hi all,

How can I read through the style attributes for a server control? It would be so convenient if one could reference an index, something like:
pnlPageHeader.Style.Keys["Top"].ToString();

TIA,

John

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Fabrizio | last post by:
Hi, There is any chance to insert a control like a text box in a panel choosing the absolute position? When I try to insert a label , the panel positions the control on a locked position. Thanks...
2
by: theComputer7 | last post by:
I cut down the code to make this half way understandable... I have read Data Grid girls caution about over use of dynamic controls. I truly believe what I am doing requires dynamically inserted...
1
by: Tia Carr | last post by:
When I try to place a child control on top of a panel control, the mouse pointer remains as a pointer instead of changing to a cross. I tried both the ShowGrid on/off, doesn't make a difference.....
2
by: acko bogicevic | last post by:
Hi I have three panels on page and every panel contains a few controls. How can i move panels through code on the other position on page. I want to click a button and one panel to be visible and...
1
by: John | last post by:
I have a panel on a webpage. I use client Javacript to manipulate its visibility using something like: Panel.style.display = 'none'. During a postback, getting the Visible attribute always...
6
by: wandali | last post by:
Hello, I have a problem in finding the status of a panel (visible or not). I have a dropdownlist that associates with a panel in which textbox are embeded in the panel. A client side VBScript is...
1
by: kishor | last post by:
Hi, In an aspx page I have used Panel. And for that panel I have added some attribute so that user can input some text. Code is given here editpn.Attributes="true"; editpn.Style.Add("overflow"...
1
by: gabe | last post by:
How do you call a client side javascript callback method after an update panel has posted back to the server? I have two update panels (A + B) with a gridview in each panel. GridView B has a...
4
by: BiffMaGriff | last post by:
Hello, I have a GridView that I put inside an update panel. I have a control that attaches to the datasource of the gridview that filters the data, databinds the gridview and then updates the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.