943,950 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 1998
  • ASP.NET RSS
Jan 20th, 2009
0

Grid and Data not showing up when viewing in browser

Expand Post »
I am unable to see the grid or the data. Here is my code from my .aspx file. I don't know what I am doing wrong:



asp.net Syntax (Toggle Plain Text)
  1. <%@ Page Language="VB" AutoEventWireup="false" CodeFile="resumesearch.aspx.vb" Inherits="_Default" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head runat="server">
  7. <title>Resume Search</title>
  8. <style type="text/css">
  9. .style1
  10. {
  11. font-size: x-large;
  12. color: #FF0000;
  13. }
  14. </style>
  15. </head>
  16. <body>
  17. <form id="form1" runat="server">
  18. <div>
  19.  
  20. <asp:Label ID="Label1" runat="server"
  21. style="font-size: xx-large; font-weight: 700"
  22. Text="RESUME SEARCH"></asp:Label>
  23. <br />
  24. <br />
  25. <span class="style1">CLICK THE HEADING LINK TO SORT<br />
  26. <br />
  27.  
  28. <asp:GridView ID="GridView1" runat="server" AllowSorting="True"
  29. AutoGenerateColumns="False">
  30. <Columns>
  31. <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
  32. <asp:BoundField DataField="First Name" HeaderText="First Name"
  33. SortExpression="First Name" />
  34. <asp:BoundField DataField="Last Name" HeaderText="Last Name"
  35. SortExpression="Last Name" />
  36. <asp:BoundField DataField="Address1" HeaderText="Address1"
  37. SortExpression="Address1" />
  38. <asp:BoundField DataField="Address2" HeaderText="Address2"
  39. SortExpression="Address2" />
  40. <asp:BoundField DataField="City" HeaderText="City" SortExpression="City" />
  41. <asp:BoundField DataField="State" HeaderText="State" SortExpression="State" />
  42. <asp:BoundField DataField="Zip" HeaderText="Zip" SortExpression="Zip" />
  43. <asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
  44. <asp:BoundField DataField="Fax" HeaderText="Fax" SortExpression="Fax" />
  45. <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
  46. <asp:BoundField DataField="School Name" HeaderText="School Name"
  47. SortExpression="School Name" />
  48. <asp:BoundField DataField="College Name" HeaderText="College Name"
  49. SortExpression="College Name" />
  50. <asp:BoundField DataField="Years Completed" HeaderText="Years Completed"
  51. SortExpression="Years Completed" />
  52. <asp:BoundField DataField="Degree" HeaderText="Degree"
  53. SortExpression="Degree" />
  54. <asp:BoundField DataField="Currently Working" HeaderText="Currently Working"
  55. SortExpression="Currently Working" />
  56. <asp:BoundField DataField="Job Title" HeaderText="Job Title"
  57. SortExpression="Job Title" />
  58. <asp:BoundField DataField="Months at Job" HeaderText="Months at Job"
  59. SortExpression="Months at Job" />
  60. <asp:BoundField DataField="Years at Job" HeaderText="Years at Job"
  61. SortExpression="Years at Job" />
  62. <asp:BoundField DataField="Job Category" HeaderText="Job Category"
  63. SortExpression="Job Category" />
  64. <asp:BoundField DataField="Expected Pay" HeaderText="Expected Pay"
  65. SortExpression="Expected Pay" />
  66. <asp:BoundField DataField="Available Start Date"
  67. HeaderText="Available Start Date" SortExpression="Available Start Date" />
  68. </Columns>
  69. </asp:GridView>
  70. </span>
  71.  
  72. </div>
  73. </form>
  74. </body>
  75. </html>




Here is my .aspx.vb (code behind) file:


VisualBasic Syntax (Toggle Plain Text)
  1. Imports System.Collections
  2. Imports System.Configuration
  3. Imports System.Data
  4. Imports System.Web
  5. Imports System.Web.Security
  6. Imports System.Web.UI
  7. Imports System.Web.UI.HtmlControls
  8. Imports System.Web.UI.WebControls
  9. Imports System.Web.UI.WebControls.WebParts
  10. Imports System.Data.OleDb
  11. Imports System.Data.OleDb.OleDbConnection
  12.  
  13.  
  14. Partial Class _Default
  15. Inherits System.Web.UI.Page
  16.  
  17.  
  18. Protected Sub Page_Load
  19.  
  20. Dim Panel1 As Panel
  21. Dim Panel2 As Panel
  22.  
  23.  
  24. Dim dtCustomerInfo As Data.DataTable
  25.  
  26. dtCustomerInfo = GetQuery("SELECT * FROM resumetable")
  27.  
  28.  
  29. GridView1.DataSource = dtCustomerInfo
  30. GridView1.DataBind()
  31.  
  32. Panel1.Visible = False
  33. Panel2.Visible = True
  34. End Sub
  35.  
  36. Private Function GetQuery(strSQL As String) As DataTable
  37. Dim dbConn As Data.OleDb.OleDbConnection
  38. Dim ExecuteReader as System.Data.OleDb.OleDbConnection
  39. Dim cmdSQL As Data.OleDb.OleDbCommand
  40. Dim dtResults As Data.DataTable
  41.  
  42. dbConn = (New Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\hosting/djbconsulting/access_db/buddyschampion.mdb"))
  43.  
  44. cmdSQL = New Data.OleDb.OleDbCommand(strSQL, dbConn)
  45.  
  46. dbConn.Open()
  47. dtResults.Load(cmdSQL.ExecuteReader())
  48. dbConn.Close()
  49.  
  50. Return dtResults
  51. End Function
  52. End Class
Last edited by peter_budo; Jan 21st, 2009 at 7:50 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
devirell is offline Offline
4 posts
since Jan 2009
Jan 21st, 2009
0

Re: Grid and Data not showing up when viewing in browser

is there data in the database?
Reputation Points: 10
Solved Threads: 0
Light Poster
julseypart is offline Offline
42 posts
since Oct 2008
Jan 21st, 2009
0

Re: Grid and Data not showing up when viewing in browser

Click to Expand / Collapse  Quote originally posted by julseypart ...
is there data in the database?

Thank you so much for emailing me back!

Yes, there is data in the database - I checked it numerous times. Data is being saved to the database, but I am unable to pull the data back into the grid. Everything works fine on my local machine, but this is being hosted by godaddy. I don't know whats going on and they are unable to help me.

The page is: www.buddyschampion.com/resumesearch.aspx. The text shows up but the grid with the data does not. Please help me!

Thanks!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
devirell is offline Offline
4 posts
since Jan 2009
Jan 22nd, 2009
0

Re: Grid and Data not showing up when viewing in browser

did u place "buddyschampion.mdb" in site
Reputation Points: 25
Solved Threads: 29
Posting Whiz
greeny_1984 is offline Offline
372 posts
since Apr 2007
Jan 22nd, 2009
0

Re: Grid and Data not showing up when viewing in browser

did u place "buddyschampion.mdb" in site

Yes I did. I have two other forms in which a user fills out a form and then clicks the submit button - the data from the form is then saved to the database. This piece works great. Now, the part that isn't working is when I try to pull the data back froom the database and into a data grid. When viewing it on my browser nothing shows up. Please see www.buddyschampion.com/resumesearch.aspx - you will only see text and no data grid holding the data.

Thanks for your help!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
devirell is offline Offline
4 posts
since Jan 2009
Jan 23rd, 2009
0

Re: Grid and Data not showing up when viewing in browser

hi ,
i read your code.
so i m help you......



first of all you use asp.net use of microsoft so there is some concept...



in this asp.net you use datasource as below of your gridview control..

select that control
and write this code


ASP.NET Syntax (Toggle Plain Text)
  1. sqldatasource1.connectionString="youe .mdb connectionSrtring"
  2. sqldatasource1.selectCommand="your select queare"

and after that pass youe sqldatasourceID to your gridview

gridview1.datasourceId=sqldatasource1.id

and then run your web page

i m sure that using this your data is display.


b'cozin asp.net for the data display datasource is complesary

so try and pls........
reply me with this code.....
Last edited by peter_budo; Jan 25th, 2009 at 5:21 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nikhilddu is offline Offline
1 posts
since Dec 2008
Jan 23rd, 2009
0

Re: Grid and Data not showing up when viewing in browser

hi,

did u give read and write permissions for the database in the site.
call u r site hosting agent and ask him to give permissions.
Reputation Points: 25
Solved Threads: 29
Posting Whiz
greeny_1984 is offline Offline
372 posts
since Apr 2007
Jan 25th, 2009
0

Re: Grid and Data not showing up when viewing in browser

Click to Expand / Collapse  Quote originally posted by nikhilddu ...
hi ,
i read your code.
so i m help you......



first of all you use asp.net use of microsoft so there is some concept...



in this asp.net you use datasource as below of your gridview control..

select that control
and write this code


ASP.NET Syntax (Toggle Plain Text)
  1. sqldatasource1.connectionString="youe .mdb connectionSrtring"
  2. sqldatasource1.selectCommand="your select queare"

and after that pass youe sqldatasourceID to your gridview

gridview1.datasourceId=sqldatasource1.id

and then run your web page

i m sure that using this your data is display.


b'cozin asp.net for the data display datasource is complesary

so try and pls........
reply me with this code.....














OK - so once I add the access connection string in the web.config file, how do I call that connection string from my aspx code behind file?

Thanks!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
devirell is offline Offline
4 posts
since Jan 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: get row index of the selected item !
Next Thread in ASP.NET Forum Timeline: GridView Insert Problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC