We are attempting to add a WebScheduleInfo control to our pages and are running into some problems with Content pages. We can successfully add all the required controls and access the SqlServer database from standalone aspx pages. But any attempts to add those exact same controls to a Master page results in a timed out connection to the database. Below are two example aspx pages.
testNoMaster.aspx. This sample works correctly, connects to the database and dispalys appointments for the current month.
<%@ Register Assembly="Infragistics35.WebUI.WebSchedule.v8.1, Version=8.1.20081.2033, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
<%@ Register Assembly="Infragistics35.WebUI.WebScheduleDataProvider.v8.1, Version=8.1.20081.2033, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
Namespace="Infragistics.WebUI.Data" TagPrefix="ig_scheduledata" %>
<head runat="server">
<body>
<form id="form1" runat="server">
<div>
SelectCommand=";"></asp:SqlDataSource>
<ig_scheduledata:WebScheduleSqlClientProvider ID="WebScheduleSqlClientProvider1"
WebScheduleInfoID="WebScheduleInfo1">
</ig_scheduledata:WebScheduleSqlClientProvider>
<igsch:WebScheduleInfo ID="WebScheduleInfo1" runat="server">
</igsch:WebScheduleInfo>
</igsch:WebMonthView>
</div>
</html>
This page times out when attempting to connect to the database. The controls in the content pane are a direct copy from the page above that works correctly.
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
</asp:Content>
Can anyone point me to a solution to this problem. If we can not find one we will most likely be finding some other controls to purchase instead.
Andrew Taft
So you have this code, and it works when it is not in a master page, but as soon as it is in a master page it stops working?
When you did what you describe in your first block of code,
WebScheduleOleDbProvider1.WebScheduleInfo = WebScheduleInfo1;WebScheduleOleDbProvider1.Connect(AccessDataSource1.ConnectionString);
can you elaborate on what happened when it didn't work? For example, did you get an error message? did it throw an exception? did both lines execute without any error? is the AccessDataSource1 ConnectionString property empty? is it referring to a WebSchedule#.mdb file in your Web application's App_Data sub-folder? are the other WebSchedule views on the master page also using this same instance of WebScheduleInfo1?
I tried all of these for the AccessDataSource and none of them work.
protected
void Page_Load(object sender, EventArgs e)
{
//Doesn't work
//WebScheduleOleDbProvider1.WebScheduleInfo = WebScheduleInfo1;
//WebScheduleOleDbProvider1.Connect(AccessDataSource1.ConnectionString);
//WebScheduleOleDbProvider1.WebScheduleInfo = this.WebScheduleInfo1;
//WebScheduleOleDbProvider1.DataSourceID = AccessDataSource1;
//Doesn't work - cannot be modified at run-time
//this.WebScheduleOleDbProvider1.DataSourceID = this.AccessDataSource1.ID;
//this.WebScheduleOleDbProvider1.DataSourceID = "ctl00$ContentPlaceHolder1$AccessDataSource1";
}
Thanks. That worked for me.
In code behind I have:
WebScheduleSqlClientProvider1.WebScheduleInfo = WebScheduleInfo1; WebScheduleSqlClientProvider1.Connect(SqlDataSource1.ConnectionString);
levon said:So you cannot do WebScheduleSqlClientProvider1.DataSource = SqlDataSource1 because there is no DataSource property for WebScheduleSqlClientProvider.
My mistake, there is no DataSource property. In that case, what you can do is call the Connect method when initializing,
WebScheduleSqlClientProvider1.Connect( SqlDataSource1.ConnectionString);
So you cannot do WebScheduleSqlClientProvider1.DataSource = SqlDataSource1 because there is no DataSource property for WebScheduleSqlClientProvider. When I try to assign DataSourceID:
WebScheduleSqlClientProvider1.DataSourceID = SqlDataSource2.ID;
I get "The DataSourceID cannot be modified at run-time. Change the Connection reference directly to assign another Connection object to the data provider" I don't want to hardcode HTML connection strings in code behind either. So how do we assign the ID's in code behind?