473,836 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting GridView width to %

I am emailing a GridView and setting its Width property to 900 before
rendering and it works great. However, when the rendering is done, I want to
reset the Width back to 95% like it was. When I try to do that it throws an
error "Conversion from string "95%" to type 'Integer' is not valid."
My code causing the error is below. Is there a work around? Thanks.

David

gvWeeklyPlanner .Width = "95%"
Nov 21 '08 #1
4 8020
maybe manually converting it...
considering that the GV requires an integer...

gvWeeklyPlanner .Width = CInt(900*0.95)
"David C" <dl*****@lifeti meinc.comescrev eu na mensagem
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
>I am emailing a GridView and setting its Width property to 900 before
rendering and it works great. However, when the rendering is done, I want
to reset the Width back to 95% like it was. When I try to do that it
throws an error "Conversion from string "95%" to type 'Integer' is not
valid."
My code causing the error is below. Is there a work around? Thanks.

David

gvWeeklyPlanner .Width = "95%"

Nov 21 '08 #2
The problem with this idea is that it will then be 95% of 900 (855) instead
of 95% of the screen width.

-David
"Christiano Donke" <cd****@digiexp ress.com.brwrot e in message
news:Oy******** ******@TK2MSFTN GP06.phx.gbl...
maybe manually converting it...
considering that the GV requires an integer...

gvWeeklyPlanner .Width = CInt(900*0.95)
"David C" <dl*****@lifeti meinc.comescrev eu na mensagem
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
>>I am emailing a GridView and setting its Width property to 900 before
rendering and it works great. However, when the rendering is done, I want
to reset the Width back to 95% like it was. When I try to do that it
throws an error "Conversion from string "95%" to type 'Integer' is not
valid."
My code causing the error is below. Is there a work around? Thanks.

David

gvWeeklyPlanne r.Width = "95%"


Nov 21 '08 #3
"David C" <dl*****@lifeti meinc.comwrote in message
news:ep******** ******@TK2MSFTN GP05.phx.gbl...
>>gvWeeklyPlann er.Width = "95%"

Maybe manually converting it...
considering that the GV requires an integer...

gvWeeklyPlanne r.Width = CInt(900*0.95)

The problem with this idea is that it will then be 95% of 900 (855)
instead of 95% of the screen width.
gvWeeklyPlanner .Width = Unit.Percentage (95);
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 21 '08 #4
You saved me again, Mark. Thank you so much.
David
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
"David C" <dl*****@lifeti meinc.comwrote in message
news:ep******** ******@TK2MSFTN GP05.phx.gbl...
>>>gvWeeklyPlan ner.Width = "95%"

Maybe manually converting it...
considering that the GV requires an integer...

gvWeeklyPlann er.Width = CInt(900*0.95)

The problem with this idea is that it will then be 95% of 900 (855)
instead of 95% of the screen width.

gvWeeklyPlanner .Width = Unit.Percentage (95);
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 21 '08 #5

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

Similar topics

5
10291
by: Steve Bugden | last post by:
Hi, I would like to set the column widths in the ASP.NET GridView control at runtime I have tried the following: http://msdn2.microsoft.com/en-us/library/ms178296.aspx Which uses the following code on a button: Protected Sub Button1_Click(ByVal sender As Object, _
0
8569
by: Innova | last post by:
Hi, We are working on a gridview inside the gridview (parent-child) scenario. The data of child grid will depend on the data of parent. Objectives: 1.Add new row in parent grid after each row and add child grid into that row because the columns in child grid are same as parent grid and we want to align them with the cols of parent grid. 2. If there is data for child grid we show a plus image in the parent row (in the row above the...
4
15444
by: Chuck | last post by:
I'm setting the column with for a gridview (25+- columns) and have paging turned on. When the gridview is first displayed, the column widths are all set to the default. But after paging to another page, the widths are set as they should be. Going back to page one, the widths are still correct. Not a clue what's going on here!
0
2483
by: Mike P | last post by:
I am trying to edit a gridview while using paging, but whenever I try to edit a row on a page other than page 1, I get an error. Here is my gridview and my code : <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" DataKeyNames="UserKey" AllowSorting="True" HeaderStyle-Height="24px" AutoGenerateColumns="false" SkinID="Grey3" EditRowStyle-CssClass="dgedit"
0
1771
by: jobo | last post by:
Hey there, I'm having a problem getting sorting to work. Here's what the GridView looks like: "server" ID="updt1" Mode="Conditional">
2
11726
by: Jacksm | last post by:
How can I align an asp:table columns with gridview columns (the widths)? I have tried setting table.column(0).width = gridview.column(0).width at page_load but it doesn't work. Thanks in advance
3
4937
by: Andrew Hayes | last post by:
In a C#.NET web page, I'm using the GridView control bound to a ObjectDataSource and the binding and data reading works fine. It auto generates the columns from the SelectMethod and makes the drid wide enough to show them all. The problem comes when I have an asp:Panel control around the grid (to generate scrollbars if the GridView is larger than the screen size). It always make the encompassing control as wide as the GridView.
8
9158
by: Jeff | last post by:
ASP.NET 2.0 I have a webpage which contains a GridView. I want this GridView's HeaderTemplate to display the text "Inbox" or "Outbox"... So I think I need to set the value in the code behind file... Anyone got any tips about how to do this? Jeff
0
4670
by: sharonrao123 | last post by:
hello all, I have a parent gridview company and in this one a nested gridview people, Is it possible to allow the user to select one row or multiple rows from the people gridview using a check box and also get the datakey (in my case personid) of the the rows selected. Please point me in the right direction. This is what i have so far but i have problem accessing the child gridview in the button click event Cheers, Shilpa. <asp:GridView...
0
9654
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10818
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10526
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9348
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7770
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5641
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4436
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3094
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.