There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
GridView Problem


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
denise_0006's Avatar
Junior Member with 20 posts.
 
Join Date: Jun 2007
Experience: student
08-Oct-2007, 08:39 AM #1
GridView Problem
we have a problem with our project!! HELP!

What we are using:
IDE:Microsoft Visual Web Developer 2005 Express Edition.
Scripts & Languages used: C# and ASP.NET
Database: Using the built-in in web developer 2005 xpress ed.

Project Problem:
1.) We were able to display data from the database using gridview! The problem is, the data table always go beyond borders with our page! how do we set the table size of gridview?
2.) In our project specs, clients can post comments!. When we add a comment we click save and it adds to the database. the only problem is, We want this comment to display right away when clicking the add comment button!! The comments are placed in a gridview too and it just doesn't display the comment we add! We have to go to another page and then go back to comments page to read the newly added comment!

ASP.NET IS SOOOOO HARD! Our Project is due this Monday and today is Tuesday! we have a few days before project presentation! please help!
denise_0006's Avatar
Junior Member with 20 posts.
 
Join Date: Jun 2007
Experience: student
08-Oct-2007, 08:41 AM #2
BY THE WAY!! here is the gridview code for the first problem!

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="PersonID"
DataSourceID="SqlDataSource1">
<Columns>
<asp:HyperLinkField
Text="Edit" DataNavigateUrlFields="PersonID" DataNavigateUrlFormatString="EditPersonDetails.aspx?PersonID={0}" />
<asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
<asp:BoundField DataField="MiddleName" HeaderText="MiddleName" SortExpression="MiddleName" />
<asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
<asp:BoundField DataField="PersonAddress" HeaderText="PersonAddress" SortExpression="PersonAddress" />
<asp:BoundField DataField="PersonContactNum" HeaderText="PersonContactNum" SortExpression="PersonContactNum" />
<asp:BoundField DataField="PersonEmailAdd" HeaderText="PersonEmailAdd" SortExpression="PersonEmailAdd" />
</Columns>

AND BY THE WAY, To understand Problem Number two, it is definitely like this in this forums.! You Post a Message, then click Post Reply.. and in a matter of seconds you can view your message! How do you do that in ASP.Net???? The only thing is that instead of seeing it in a textarea, you see the post in a gridview format!!! HELP!

Last edited by denise_0006 : 08-Oct-2007 08:47 AM.
jbutton7's Avatar
Member with 99 posts.
 
Join Date: Nov 2003
08-Oct-2007, 08:57 AM #3
Well you could set the GridView's width to 100% which should stretch it to the width of the page no matter what. in order to do this, you would add a Width="100%" to your declaration statement.

<asp:GridView ID="GridView1" runat="server" Width="100%" AutoGenerateColumns="False" DataKeyNames="PersonID"
DataSourceID="SqlDataSource1">

Hope this helps.

-Josh
denise_0006's Avatar
Junior Member with 20 posts.
 
Join Date: Jun 2007
Experience: student
08-Oct-2007, 09:32 AM #4
Hey! thanks for the reply but unfortunately I tried doing that but it still goes beyond borders!! and I tried answering my problem #2 and solved it myself!!! hahahaha) i just used server.transfer(url);
denise_0006's Avatar
Junior Member with 20 posts.
 
Join Date: Jun 2007
Experience: student
08-Oct-2007, 09:47 AM #5
For Everyone who wants to answer this problem of mine.. coz im reallly desperate! here is a link (for screenshot) of my problem:
http://img530.imageshack.us/img530/6263/helpgs8.jpg


as you can see the table is way over the border! and we need that to be corrected ASAP!

<img src="http://img530.imageshack.us/my.php?image=helpgs8.jpg" />
jbutton7's Avatar
Member with 99 posts.
 
Join Date: Nov 2003
08-Oct-2007, 11:46 AM #6
Have you tested in Internet Explorer too? Just out of curiosity.
denise_0006's Avatar
Junior Member with 20 posts.
 
Join Date: Jun 2007
Experience: student
08-Oct-2007, 08:05 PM #7
yes... we've tried it in internet explorer! it still doesn't work
jbutton7's Avatar
Member with 99 posts.
 
Join Date: Nov 2003
09-Oct-2007, 08:44 AM #8
You could force the width to be a specific number of pixels. You would then have to kind of switch resolutions around a bit and test what it looks like on various resolutions (this is something you should always do anyway). So just like before.

<asp:GridView ID="GridView1" runat="server" Width="600" AutoGenerateColumns="False" DataKeyNames="PersonID"
DataSourceID="SqlDataSource1">

You could also try setting your header wrap attribute to wrap text. If your text in the header of the gridview is longer than the width allows, it overrides width settings.

<asp:GridView ID="GridView1" runat="server" Width="600" AutoGenerateColumns="False" HeaderStyle Wrap = "true" DataKeyNames="PersonID"
DataSourceID="SqlDataSource1">
jbutton7's Avatar
Member with 99 posts.
 
Join Date: Nov 2003
09-Oct-2007, 08:46 AM #9
reading over my last post i realized im not 100% sure on this. its either HeadStyle-Wrap = "true" or HeaderStyle Wrap = "true". I can't remember whether or not that hyphen is there.
denise_0006's Avatar
Junior Member with 20 posts.
 
Join Date: Jun 2007
Experience: student
09-Oct-2007, 11:44 AM #10
gosh! im sorry! it still did not work... thanks anyways for the help! maybe this info might help!! this page is using master pages!!! hehehe
jbutton7's Avatar
Member with 99 posts.
 
Join Date: Nov 2003
09-Oct-2007, 12:17 PM #11
I have a feeling that has something to do with it. If your master page sets some sort of layout for your controls then it would probably (?) override any individual attribute change you try to make. I would scan through your master page code and see if you can find anything that raises a red flag. So when you try to set Width="100%" it is probably not even seeing it because it is being overridden at the master page level. This is where I would start anyway.
denise_0006's Avatar
Junior Member with 20 posts.
 
Join Date: Jun 2007
Experience: student
09-Oct-2007, 08:17 PM #12
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<link rel="stylesheet" type="text/css" href="StyleSheet.css" />
<link rel="icon" HREF="images/icon2.ico">
<title>sober.minds</title>
</head>
<body bgcolor="#000000" background="images/mbg.jpg">
<form id="form1" runat="server">
<div>
&nbsp;<table class="def" align="center" cellpadding="0" cellspacing="0" width="800">
<tr>
<td align="center" background="images/head copy.png" height="100" valign="top" width="800">
</td>
</tr>
<tr><td>
<table background="images/bg copy.jpg" width="800" cellpadding="0" cellspacing="0">
<tr>
<td style="height: 20px; width: 200px;" valign="top">
<div align="center"><br />
<img src="images/flash/menuhead.png" /><br />
<OBJECT classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
WIDTH="150" HEIGHT="350" id="menuname" align="absMiddle"><PARAM NAME=movie VALUE="images/flash/menu.swf"><PARAM NAME=quality VALUE=high><EMBED src="images/flash/menu.swf" WIDTH="150" HEIGHT="350"
NAME="myMovieName" align="center" type="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT><p class="pm">
&nbsp;</p>
</div>
</td>
<td align="left" colspan="2" style="height: 20px" valign="top" width="600">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
</table>
</td></tr>
<tr>
<td align="center" background="images/foot copy.png" height="30" valign="top" width="800">
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

This is my masterpage! Maybe posting it might help!
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 02:20 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.