Solved

Geting the width of a detailsview at runtime

Posted on 2011-09-07
3
241 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
3 Comments
 
LVL 51

Assisted Solution

by:HainKurt
HainKurt 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Name space syntax error 12 41
ASP.NET 5 Templates 2 66
Polygon I google maps 1 14
Could you point what are the icon(s) available when using  jquery.validate.min.js  ? 8 19
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now