Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 11th, 2009, 12:56 PM
Authorized User
 
Join Date: Mar 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default FindControl Problem Production Server

I've got a Web User Control that contains a DetailsView. When that DetailsView is databound in my Development Environment everything works fine, but when the page is moved to the production server, the findcontrol isn't finding anything. Got any ideas?

Protected Sub DetailsView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView1.DataBound
If Me.DetailsView1.CurrentMode = DetailsViewMode.Edit Then

Dim temp As BLL.Events = Me.DetailsView1.DataItem
Dim tempddl As DropDownList
tempddl = DetailsView1.FindControl("ddlcolor")
tempddl.SelectedValue = temp.Backcolor
End If
End Sub


<asp:TemplateField HeaderText="Backcolor" SortExpression="Backcolor">
<EditItemTemplate>
<asp:DropDownList ID="ddlColor" runat="server" DataSourceID="odsColors" DataTextField="value"
DataValueField="value">
</asp:DropDownList>
<asp:ObjectDataSource ID="odsColors" runat="server" SelectMethod="GetColors"
TypeName="dsci.landwarrior.UI.Helpers">
<SelectParameters>
<asp:Parameter DefaultValue="False" Name="insertEmpty" Type="Boolean" />
</SelectParameters>
</asp:ObjectDataSource>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("Backcolor") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

The web control is on a page that uses a Master Page if that has any thing to do with it.
 
Old March 11th, 2009, 03:28 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Take a look at your rendered page source. When you drop this user control into a page, I think you will find that the ID of ddlColor has been mangled by the runtime...
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
 
Old March 11th, 2009, 03:39 PM
Authorized User
 
Join Date: Mar 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Turns out that the DataItem was Nothing(weak sql query) so there wasn't anything to Edit. I guess that kept the DropDownList from getting generated which led to the Find Control not returning anything.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Deploying Asp.net application on Production server Nabeel82 ASP.NET 2.0 Professional 1 March 20th, 2009 06:17 PM
~* Installing MSRS in Production Server *~ chakravarthy_vr Reporting Services 0 March 9th, 2006 09:31 PM
Problem with FindControl RussC Excel VBA 1 June 16th, 2004 11:58 AM
values not showing in production server. stewdabaker Classic ASP Databases 1 June 9th, 2004 03:42 PM
FindControl Method problem jbenson001 ASP.NET 1.x and 2.0 Application Design 3 March 8th, 2004 10:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.