Solved

Geting the width of a detailsview at runtime

Posted on 2011-09-07
3
244 Views
Last Modified: 2012-05-12
Hello Experts,

I'm getting the impression this isn't as easy as I'd like it to be.  Still, I need to be able to retrieve the width of my detailsview object at runtime.  It expands to the length of the content, so it can be any width.

Essentially I need to be able to mirror it's look with a table, and that all works except I don't know what to set the table width to.

I'd prefer a server-side solution, but have a sinking feeling it may require require javascript.

Thanks!
Moe
0
Comment
Question by:mauricerichard
[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
3 Comments
 
LVL 53

Assisted Solution

by:Huseyin KAHRAMAN
Huseyin KAHRAMAN earned 200 total points
ID: 36497800
here:

<table id=tbl><tr><td>Hain Kurt</td></tr></table>
<script>
alert(tbl.clientWidth);
</script>

you may need to use

tbl.clientWidth
-->
<%tbl.ClientID%>.clientWidth

or

document.getElementById("<%tbl.ClientID%>").clientWidth
0
 
LVL 12

Accepted Solution

by:
Ramkisan Jagtap earned 300 total points
ID: 36528482
Hi,
You can place a hidden field on the page. Make it runat server. Set the hidden field value to with details view width using javascript. Then access the hidden field value at Server side.

Regards,
Ram
0
 
LVL 1

Author Closing Comment

by:mauricerichard
ID: 36551590
Great advice, thanks very much!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

739 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