Detailsview not visible
Hi, I have a DetailsView on my page that connects to a SQL server D/B and shows its data.However, It is not visible on my page when I launch my browser. Any ideas or past experience with this? Thanks for reading.
majestic0110
Nearly a Posting Virtuoso
1,328 posts since Oct 2007
Reputation Points: 256
Solved Threads: 72
Can you post some code from aspx and code behind?
ManicCW
Junior Poster in Training
95 posts since Nov 2005
Reputation Points: 13
Solved Threads: 11
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="page.aspx.cs" Inherits="Restricted_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD html 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0047)http://localhost:51704/DeaDtsAsp/LoginPage.aspx -->
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta content="MShtml 6.00.6000.16587" name="GENERATOR"/><link rel="stylesheet" type="text/css" href="demo.CSS" /></head>
<body runat="server">
<h1 runat="server" visible="true">You are logged in</h1>
<h1 runat="server" visible="true">
Sponsor with the following details:</h1>
<p>
</p>
<p runat="server" visible="false">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:demoConnectionString %>"
SelectCommand="SELECT [username], [role], [email], [tel], [fax], [organisation] FROM [users] WHERE ([username] = @username)"
OnSelecting="SqlDataSource1_Selecting" ProviderName="<%$ ConnectionStrings:demoConnectionString.ProviderName %>">
<SelectParameters>
<asp:ProfileParameter Name="username" PropertyName="username" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="SqlDataSource1"
Height="0px" Width="0px" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="0px" CellPadding="4"
ForeColor="Black" OnPageIndexChanging="DetailsView1_PageIndexChanging" EmptyDataText="N/A">
<Fields>
<asp:BoundField DataField="username" HeaderText="username" SortExpression="username" />
<asp:BoundField DataField="role" HeaderText="role" SortExpression="role" />
<asp:BoundField DataField="email" HeaderText="email" SortExpression="email" />
<asp:BoundField DataField="tel" HeaderText="tel" SortExpression="tel" />
<asp:BoundField DataField="fax" HeaderText="fax" SortExpression="fax" />
<asp:BoundField DataField="organisation" HeaderText="organisation" SortExpression="organisation" />
</Fields>
<FooterStyle BackColor="#CCCC99" />
<RowStyle BackColor="#F7F7DE" />
<PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
<HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:DetailsView>
</p>
</body></html>
majestic0110
Nearly a Posting Virtuoso
1,328 posts since Oct 2007
Reputation Points: 256
Solved Threads: 72
interesting I added this code in the C# code behind file as I read that it would prevent the error message described below:
Code:
//public override void VerifyRenderingInServerForm(Control control)
//{
//}
the error msg was
Exception Details: System.Web.HttpException: Control 'DetailsView1' of type 'DetailsView' must be placed inside a form tag with runat=server
Thought that might help you all help me lol. Thanks
majestic0110
Nearly a Posting Virtuoso
1,328 posts since Oct 2007
Reputation Points: 256
Solved Threads: 72
Forgot, here is the stack trace:
HttpException (0x80004005): Control 'DetailsView1' of type 'DetailsView' must be placed inside a form tag with runat=server.]
System.Web.UI.Page.VerifyRenderingInServerForm(Control control) +2049759
System.Web.UI.WebControls.DetailsView.Render(HtmlTextWriter writer, Boolean renderPanel) +37
System.Web.UI.WebControls.DetailsView.Render(HtmlTextWriter writer) +30
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
System.Web.UI.Page.Render(HtmlTextWriter writer) +26
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint
majestic0110
Nearly a Posting Virtuoso
1,328 posts since Oct 2007
Reputation Points: 256
Solved Threads: 72
have realised that putting the details view inside tag has same effect as
//public override void VerifyRenderingInServerForm(Control control)
//{
//}
majestic0110
Nearly a Posting Virtuoso
1,328 posts since Oct 2007
Reputation Points: 256
Solved Threads: 72
i.e. the view is still not shown lol
majestic0110
Nearly a Posting Virtuoso
1,328 posts since Oct 2007
Reputation Points: 256
Solved Threads: 72
the odd thing is when I try to run this code on an XP machine (as opposed to vista home basic) it works fine........odd. Any ideas?
majestic0110
Nearly a Posting Virtuoso
1,328 posts since Oct 2007
Reputation Points: 256
Solved Threads: 72
Careful, XP professional edition comes basically server ready, while vista home basic does not. And they actually prevent you from using vista home basic as a server.
SheSaidImaPregy
Veteran Poster
1,080 posts since Sep 2007
Reputation Points: 43
Solved Threads: 68
i thought as much its because basic doesnt have IIS support I think
majestic0110
Nearly a Posting Virtuoso
1,328 posts since Oct 2007
Reputation Points: 256
Solved Threads: 72
That's right.
They won't even "allow" you to install IIS.
SheSaidImaPregy
Veteran Poster
1,080 posts since Sep 2007
Reputation Points: 43
Solved Threads: 68
how generous! lol thanks mate for your replies. Do you have any suggestions? other than an XP installation lol
majestic0110
Nearly a Posting Virtuoso
1,328 posts since Oct 2007
Reputation Points: 256
Solved Threads: 72
I use vista premium, works great.
Upgrade to that ^^
SheSaidImaPregy
Veteran Poster
1,080 posts since Sep 2007
Reputation Points: 43
Solved Threads: 68
majestic0110
Nearly a Posting Virtuoso
1,328 posts since Oct 2007
Reputation Points: 256
Solved Threads: 72
majestic0110
Nearly a Posting Virtuoso
1,328 posts since Oct 2007
Reputation Points: 256
Solved Threads: 72
You don't need IIS if you have Visual Studio 2005 Express Edition (any edition 2005+) It includes a web server. When you run the app from VS (F5 to debug, or Ctrl+F5 to run without debugger) it starts up automatically on http://localhost: (you get an icon in your sys tray too showing it's running)
hollystyles
Veteran Poster
1,182 posts since Feb 2005
Reputation Points: 262
Solved Threads: 68
interestingly, after downgrading to xp and using gridview I am able to display my d/b! Yippee! I wonder why that would not work in vista?! Trying to get update working now and delete
majestic0110
Nearly a Posting Virtuoso
1,328 posts since Oct 2007
Reputation Points: 256
Solved Threads: 72
after hitting the auto generated update button:
You have specified that your update command compares all values on SqlDataSource 'SqlDataSource1', but the dictionary passed in for oldValues is empty. Pass in a valid dictionary for update or change your mode to OverwriteChanges.
any ideas?
thanks
majestic0110
Nearly a Posting Virtuoso
1,328 posts since Oct 2007
Reputation Points: 256
Solved Threads: 72
its ok fixed it lol turned off optimistic concurrency then it worked. does anybody know why that might be ?
majestic0110
Nearly a Posting Virtuoso
1,328 posts since Oct 2007
Reputation Points: 256
Solved Threads: 72
ok so I know gridview works with the edit/delete buttons that are built in with gridview, but how would I go about using my own (separate buttons) ?
majestic0110
Nearly a Posting Virtuoso
1,328 posts since Oct 2007
Reputation Points: 256
Solved Threads: 72