我正在使用中继器,它在本地系统上工作正常,但在网络服务器上上传时不工作。从我们的本地代码连接到服务器时它也可以正常工作。以下是页面代码和背后的代码。并重复包含文本框,在运行时动态加载的下拉列表
页面代码:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="UC_TopicSchedulingNew.ascx.cs" Inherits="Scheduling_UC_TopicSchedulingNew" %>
<%@ Register Assembly="XtendedControls" Namespace="XtendedControls" TagPrefix="cc1" %>
<%@ Register Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" TagPrefix="ajax" %>
<%@ Register Src="~/SelectPopup/UC_PopupDropdown.ascx" TagName="PopupSelectAny" TagPrefix="PD" %>
<script type="text/javascript">
function pageLoad() {
$('.DatepickerInput').datepicker({ changeMonth: true, changeYear: true, yearRange: '1950:2050', dateFormat: 'dd/mm/yy', showButtonPanel: true });
}
$(document).ready(function () {
$('.DatepickerInput').datepicker({ changeMonth: true, changeYear: true, yearRange: '1950:2050', dateFormat: 'dd/mm/yy', showButtonPanel: true });
});
</script>
<asp:UpdatePanel runat="server" ID="updtsForm">
<ContentTemplate>
<div style="width: 100%; float: left; padding-left: 10px;">
<div style="width: 20%; float: left; padding-left: 10px;">
<div class="editor-label" style="font-weight: bold;">
Branch : <b style="color: Red;">*</b>
</div>
<div class="editor-field">
<asp:TextBox ID="txtBranchs" runat="server" CssClass="txt-drop-down" TabIndex="1"
ReadOnly="true" Width="16px"></asp:TextBox><cc1:XBranch ID="XBranch" runat="server"
TabIndex="-1"></cc1:XBranch>
<ajax:PopupControlExtender ID="PopExBranchs" runat="server" TargetControlID="txtBranchs"
BehaviorID="exbranchClose" PopupControlID="pnlListBranchs" CommitProperty="value"
Position="Bottom" OffsetY="2" />
<asp:HiddenField ID="HFBranchID" runat="server" />
</div>
<br />
<div class="editor-label" style="font-weight: bold;">
Course : <b style="color: Red;">*</b>
</div>
<div class="editor-field">
<asp:TextBox ID="txtCourse" runat="server" CssClass="txt-drop-down" TabIndex="2"
ReadOnly="true" Width="16px"></asp:TextBox><cc1:XCourse ID="XCourse" runat="server"
TabIndex="-1"></cc1:XCourse>
<ajax:PopupControlExtender ID="PopExCourse" runat="server" TargetControlID="txtCourse"
BehaviorID="excourseClose" PopupControlID="pnlListCourse" CommitProperty="value"
Position="Bottom" OffsetY="2" />
<asp:HiddenField ID="HFCourseID" runat="server" />
</div>
<br />
<div class="editor-label" style="font-weight: bold;">
Batch :
</div>
<div class="editor-field">
<asp:TextBox ID="txtBatch" runat="server" CssClass="txt-drop-down" TabIndex="44"
ReadOnly="true" Width="16px"></asp:TextBox><cc1:XTextBox ID="XBatch" runat="server"
TabIndex="-1"></cc1:XTextBox>
<ajax:PopupControlExtender ID="PopExBatch" runat="server" TargetControlID="txtBatch"
BehaviorID="exBatchClose" PopupControlID="pnlListBatch" CommitProperty="value"
Position="Bottom" OffsetY="2" />
<asp:HiddenField ID="HFBatchID" runat="server" Value="0" />
<asp:HiddenField ID="HFBatchClRoom" runat="server" />
</div>
<br />
</div>
<div style="width: 20%; float: left; padding-left: 10px;">
<div class="editor-label" style="font-weight: bold;">
Time :
</div>
<div class="editor-field">
<cc1:XTextBox ID="XTime" runat="server" TabIndex="-1" Width="149px"></cc1:XTextBox>
</div>
<br />
<div class="editor-label" style="font-weight: bold;">
Start Date :
</div>
<div class="editor-field">
<cc1:XTextBox ID="XStartDate" runat="server" TabIndex="-1" Width="149px"></cc1:XTextBox>
</div>
<br />
<div class="editor-label" style="font-weight: bold;">
End Date :
</div>
<div class="editor-field">
<cc1:XTextBox ID="XEndDate" runat="server" TabIndex="-1" Width="149px"></cc1:XTextBox>
</div>
<br />
</div>
<div style="width: 50%; float: left; padding-left: 10px;">
<div class="editor-label" style="font-weight: bold;">
Curriculum :
</div>
<div class="editor-field">
<asp:TextBox ID="txtCurriculum" runat="server" CssClass="txt-drop-down" TabIndex="44"
ReadOnly="true" Width="16px"></asp:TextBox><cc1:XCurriculum ID="XCurriculum" runat="server"
TabIndex="-1"></cc1:XCurriculum>
<ajax:PopupControlExtender ID="popExCurriculum" runat="server" TargetControlID="txtCurriculum"
BehaviorID="exCurriculumClose" PopupControlID="pnlListCurriculum" CommitProperty="value"
Position="Bottom" OffsetY="2" />
<asp:HiddenField ID="HFCurriculumID" runat="server" Value="0" />
</div>
<br />
<div class="editor-label" style="font-weight: bold;">
Faculty :
</div>
<div class="editor-field">
<asp:TextBox ID="txtFaculty" runat="server" CssClass="txt-drop-down" TabIndex="44"
ReadOnly="true" Width="16px"></asp:TextBox><cc1:XFaculty ID="XFaculty" runat="server"
TabIndex="-1"></cc1:XFaculty>
<ajax:PopupControlExtender ID="PopExFaculty" runat="server" TargetControlID="txtFaculty"
BehaviorID="exFacultyClose" PopupControlID="pnlListFaculty" CommitProperty="value"
Position="Bottom" OffsetY="2" />
<asp:HiddenField ID="HFFacultyID" runat="server" Value="0" />
</div>
<br />
<div class="editor-label" style="font-weight: bold;">
<asp:Button ID="btnGet" runat="server" Text="Get Topics"
onclick="btnGet_Click" />
</div>
</div>
</div>
<br />
<br />
<b>Topics : </b>
<br />
<br />
<div style="width: 100%; float: left; height: 250px; overflow: scroll; border: solid 1px gray;">
<asp:Repeater ID="rptTopics" runat="server">
<HeaderTemplate>
<table class="grid-new" cellpadding="0" cellspacing="0" id="table1">
<thead>
<th class="myheadth" style="text-align: left; width: 40px;">
Srno.
</th>
<th class="myheadth" style="text-align: left; width: 300px;">
Topic
</th>
<th class="myheadth" style="text-align: left; width: 80px;">
Topic Date
</th>
<th class="myheadth" style="text-align: left; width: 60px;">
St. Time
</th>
<th class="myheadth" style="text-align: left; width: 60px;">
En. Time
</th>
<th class="myheadth" style="text-align: left;">
Classroom
</th>
</thead>
<tbody>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td style="text-align: left; width: 40px;">
<%#Container.ItemIndex+1 %>
</td>
<td style="text-align: left; width: 300px;">
<asp:Label ID="lblID" runat="server" Text='<%#Eval("ID")%>' Visible="false"></asp:Label>
<%#Eval("TopicName")%>
</td>
<td style="text-align: left; width: 80px;">
<div id="DatepickerDiv" class="demo">
<asp:TextBox ID="txtTopicDate" runat="server" CssClass="DatepickerInput" Font-Names="Verdana"
TabIndex="5" Font-Size="11px" Width="70px" Style="border: solid 1px gray;"></asp:TextBox>
</div>
</td>
<td style="text-align: left; width: 60px;">
<cc1:XStartTime ID="XStartTime" runat="server" Width="50px"></cc1:XStartTime>
</td>
<td style="text-align: left; width: 60px;">
<cc1:XEndTime ID="XEndTime" runat="server" Width="50px"></cc1:XEndTime>
</td>
<td style="text-align: left;">
<asp:DropDownList ID="ddlListView" runat="server">
</asp:DropDownList>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</tbody> </table>
</FooterTemplate>
</asp:Repeater>
</div>
<div style="width:100%; float:left; padding-top:20px;">
<asp:Button ID="btnSave" runat="server" Text="Save" Width="70px" OnClick="btnSave_Click" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel runat="server" ID="updPanels">
<ContentTemplate>
<asp:Panel ID="pnlListBranchs" runat="server" BackColor="White" ForeColor="Black"
Width="300px" Height="250px" ScrollBars="Vertical" BorderStyle="Solid" BorderWidth="1px"
BorderColor="Gray">
<PD:PopupSelectAny ID="pdBranchs" runat="server" />
</asp:Panel>
<asp:Panel ID="pnlListCourse" runat="server" BackColor="White" ForeColor="Black"
Width="300px" Height="250px" ScrollBars="Vertical" BorderStyle="Solid" BorderWidth="1px"
BorderColor="Gray">
<PD:PopupSelectAny ID="pdCourse" runat="server" />
</asp:Panel>
<asp:Panel ID="pnlListBatch" runat="server" BackColor="White" ForeColor="Black" Width="300px"
Height="250px" ScrollBars="Vertical" BorderStyle="Solid" BorderWidth="1px" BorderColor="Gray">
<PD:PopupSelectAny ID="pdBatch" runat="server" />
</asp:Panel>
<asp:Panel ID="pnlListCurriculum" runat="server" BackColor="White" ForeColor="Black"
Width="300px" Height="250px" ScrollBars="Vertical" BorderStyle="Solid" BorderWidth="1px"
BorderColor="Gray">
<PD:PopupSelectAny ID="pdCurriculum" runat="server" />
</asp:Panel>
<asp:Panel ID="pnlListFaculty" runat="server" BackColor="White" ForeColor="Black"
Width="300px" Height="250px" ScrollBars="Vertical" BorderStyle="Solid" BorderWidth="1px"
BorderColor="Gray">
<PD:PopupSelectAny ID="pdFaculty" runat="server" />
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
代码背后:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class Scheduling_UC_TopicSchedulingNew : System.Web.UI.UserControl
{
delegate void dlgTsBranchs();
delegate void dlgTsClassrooms();
delegate void dlgTsCourses();
delegate void dlgTsBatches();
delegate void dlgTsCurriculums();
delegate void dlgTsFaculties();
protected void Page_Load(object sender, EventArgs e)
{
this.pdBranchs.dlgSelectRecords += new dlgSelectRecords(pdBranchs_dlgSelectRecords);
dlgTsBranchs dlgTsBranchs = new dlgTsBranchs(getBranchs);
this.pdBranchs.PageMethodWithListRecords = dlgTsBranchs;
this.pdCourse.dlgSelectRecords += new dlgSelectRecords(pdCourse_dlgSelectRecords);
dlgTsCourses dlgTsCourses = new dlgTsCourses(getCourses);
this.pdCourse.PageMethodWithListRecords = dlgTsCourses;
this.pdFaculty.dlgSelectRecords += new dlgSelectRecords(pdFaculty_dlgSelectRecords);
dlgTsFaculties dlgTsFaculties = new dlgTsFaculties(getFaculties);
this.pdFaculty.PageMethodWithListRecords = dlgTsFaculties;
this.pdBatch.dlgSelectRecords += new dlgSelectRecords(pdBatch_dlgSelectRecords);
dlgTsBatches dlgAdBatches = new dlgTsBatches(getBatches);
this.pdBatch.PageMethodWithListRecords = dlgAdBatches;
this.pdCurriculum.dlgSelectRecords += new dlgSelectRecords(pdCurriculum_dlgSelectRecords);
dlgTsCurriculums dlgTsCurriculums = new dlgTsCurriculums(getCurriculum);
this.pdCurriculum.PageMethodWithListRecords = dlgTsCurriculums;
if (!IsPostBack)
{
disbleEnterKeyForTextBoxes();
}
}
public void disbleEnterKeyForTextBoxes()
{
XTime.Attributes.Add("onkeydown", "return (event.keyCode!=13);");
}
void pdFaculty_dlgSelectRecords(object source, RepeaterCommandEventArgs e, string selval)
{
String[] Myvals = selval.Split('\t');
XFaculty.Text = Myvals[0].ToString();
HFFacultyID.Value = Myvals[1].ToString();
PopExFaculty.Cancel();
}
void pdCurriculum_dlgSelectRecords(object source, RepeaterCommandEventArgs e, string selval)
{
String[] Myvals = selval.Split('\t');
XCurriculum.Text = Myvals[0].ToString();
HFCurriculumID.Value = Myvals[1].ToString();
popExCurriculum.Cancel();
getFaculties();
XFaculty.Text = "";
HFFacultyID.Value = "0";
rptTopics.DataSource = null;
rptTopics.DataBind();
}
void pdBatch_dlgSelectRecords(object source, RepeaterCommandEventArgs e, string selval)
{
String[] Myvals = selval.Split('\t');
XBatch.Text = Myvals[0].ToString();
HFBatchID.Value = Myvals[1].ToString();
PopExBatch.Cancel();
Models.Batch objBatch = new BLL.Batch().OpenByID(HFBatchID.Value);
XTime.Text = objBatch.Time;
XStartDate.Text = objBatch.StDate;
XEndDate.Text = objBatch.EnDate;
HFBatchClRoom.Value = objBatch.ClassRoomID.ToString();
getCurriculum();
XCurriculum.Text = "";
HFCurriculumID.Value = "0";
XFaculty.Text = "";
HFFacultyID.Value = "0";
rptTopics.DataSource = null;
rptTopics.DataBind();
}
void pdCourse_dlgSelectRecords(object source, RepeaterCommandEventArgs e, string selval)
{
String[] Myvals = selval.Split('\t');
XCourse.Text = Myvals[0].ToString();
HFCourseID.Value = Myvals[1].ToString();
PopExCourse.Cancel();
XBatch.Text = "";
HFBatchID.Value = "0";
XTime.Text = "";
XStartDate.Text = "";
XEndDate.Text = "";
getBatches();
XCurriculum.Text = "";
HFCurriculumID.Value = "0";
XFaculty.Text = "";
HFFacultyID.Value = "0";
rptTopics.DataSource = null;
rptTopics.DataBind();
}
void pdBranchs_dlgSelectRecords(object source, RepeaterCommandEventArgs e, string selval)
{
String[] Myvals = selval.Split('\t');
XBranch.Text = Myvals[0].ToString();
HFBranchID.Value = Myvals[1].ToString();
PopExBranchs.Cancel();
getCourses();
XCourse.Text = "";
HFCourseID.Value = "0";
XBatch.Text = "";
HFBatchID.Value = "0";
XTime.Text = "";
XStartDate.Text = "";
XEndDate.Text = "";
XCurriculum.Text = "";
HFCurriculumID.Value = "0";
XFaculty.Text = "";
HFFacultyID.Value = "0";
rptTopics.DataSource = null;
rptTopics.DataBind();
}
public void getBranchs()
{
try
{
Type newClass = typeof(PopupListSelect.Branch);
Repeater nlpListview = (Repeater)pdBranchs.FindControl("gvpbList");
object created = Activator.CreateInstance(newClass, Session["User"].ToString(), Session["DesigID"].ToString(), nlpListview);
}
catch
{
}
}
public void getCourses()
{
try
{
Type newClass = typeof(PopupListSelect.Course);
Repeater nlpListview = (Repeater)pdCourse.FindControl("gvpbList");
object created = Activator.CreateInstance(newClass, HFBranchID.Value, nlpListview);
}
catch
{
}
}
public void getBatches()
{
try
{
if (Session["DesigID"].Equals("6") || Session["DesigID"].Equals("7"))
{
Type newClass = typeof(PopupListSelect.Batch);
Repeater nlpListview = (Repeater)pdBatch.FindControl("gvpbList");
object created = Activator.CreateInstance(newClass, HFBranchID.Value, HFCourseID.Value, Session["User"].ToString(), nlpListview);
}
else
{
Type newClass = typeof(PopupListSelect.Batch);
Repeater nlpListview = (Repeater)pdBatch.FindControl("gvpbList");
object created = Activator.CreateInstance(newClass, HFBranchID.Value, HFCourseID.Value, nlpListview);
}
}
catch
{
}
}
public void getCurriculum()
{
try
{
Type newClass = typeof(PopupListSelect.Curriculum);
Repeater nlpListview = (Repeater)pdCurriculum.FindControl("gvpbList");
object created = Activator.CreateInstance(newClass, nlpListview, HFBatchID.Value);
}
catch
{
}
}
public void getFaculties()
{
try
{
Type newClass = typeof(PopupListSelect.Faculties);
Repeater nlpListview = (Repeater)pdFaculty.FindControl("gvpbList");
object created = Activator.CreateInstance(newClass, HFBranchID.Value, HFCurriculumID.Value, HFBatchID.Value, nlpListview);
}
catch
{
}
}
public void getTopics()
{
try
{
Type newClass = typeof(PopupListSelect.Topics);
object created = Activator.CreateInstance(newClass, HFCurriculumID.Value, rptTopics);
String[] TimeVals = XTime.Text.Split('-');
foreach (RepeaterItem itm in rptTopics.Items)
{
TextBox XStartTime = (TextBox)itm.FindControl("XStartTime");
TextBox XEndTime = (TextBox)itm.FindControl("XEndTime");
DropDownList ddlListView = (DropDownList)itm.FindControl("ddlListView");
XStartTime.Text = TimeVals[0].ToString().Trim();
XEndTime.Text = TimeVals[1].ToString().Trim();
try
{
newClass = typeof(PopupListSelect.Classrooms);
created = Activator.CreateInstance(newClass, Int32.Parse(HFBranchID.Value), ddlListView);
ddlListView.SelectedValue = HFBatchClRoom.Value;
}
catch
{
}
}
}
catch
{
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
DataTable dt = new DataTable();
DataColumn dc;
DataRow dr;
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.Int32");
dc.ColumnName = "BranchID";
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.Int32");
dc.ColumnName = "CourseID";
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.Int32");
dc.ColumnName = "BatchID";
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.Int32");
dc.ColumnName = "CurriID";
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.Int32");
dc.ColumnName = "TopicID";
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.String");
dc.ColumnName = "TopicDate";
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.String");
dc.ColumnName = "StartTime";
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.String");
dc.ColumnName = "EndTime";
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.Int32");
dc.ColumnName = "ClassroomID";
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.String");
dc.ColumnName = "FacultyID";
dc.Unique = false;
dt.Columns.Add(dc);
foreach (RepeaterItem itm in rptTopics.Items)
{
TextBox XStartTime = (TextBox)itm.FindControl("XStartTime");
TextBox XEndTime = (TextBox)itm.FindControl("XEndTime");
DropDownList ddlListView = (DropDownList)itm.FindControl("ddlListView");
TextBox txtTopicDate = (TextBox)itm.FindControl("txtTopicDate");
Label lblID = (Label)itm.FindControl("lblID");
if (!txtTopicDate.Text.Equals(""))
{
dr = dt.NewRow();
dr["BranchID"] = Int32.Parse(HFBranchID.Value);
dr["CourseID"] = Int32.Parse(HFCourseID.Value);
dr["BatchID"] = Int32.Parse(HFBatchID.Value);
dr["CurriID"] = Int32.Parse(HFCurriculumID.Value);
dr["TopicID"] = Int32.Parse(lblID.Text);
dr["TopicDate"] = new Common.GeneralFunctions().ConvertDate_MM_DD_YY(txtTopicDate.Text.Trim());
dr["StartTime"] = XStartTime.Text;
dr["EndTime"] = XEndTime.Text;
dr["ClassroomID"] = Int32.Parse(ddlListView.SelectedValue);
dr["FacultyID"] = HFFacultyID.Value;
dt.Rows.Add(dr);
}
}
TopicScheduling.ScheduledTopics.XMLSaveTopicsToSchedule(dt);
Response.Redirect("~/Topic-Scheduling");
}
protected void btnGet_Click(object sender, EventArgs e)
{
getTopics();
//new BLL.Sch().Topics(Int32.Parse(HFBranchID.Value), Int32.Parse(HFCourseID.Value), Int32.Parse(HFBatchID.Value), Int32.Parse(HFCurriculumID.Value),HFFacultyID.Value,rptTopics);
Models.ScheduledTopics obj = new Models.ScheduledTopics();
obj.BranchID = Int32.Parse(HFBranchID.Value);
obj.CourseID = Int32.Parse(HFCourseID.Value);
obj.BatchID = Int32.Parse(HFBatchID.Value);
obj.CurriID = Int32.Parse(HFCurriculumID.Value);
List<Models.ScheduledTopics> objCollect = TopicScheduling.ScheduledTopics.ScheduledTopicsList(obj);
foreach (RepeaterItem itm in rptTopics.Items)
{
TextBox XStartTime = (TextBox)itm.FindControl("XStartTime");
TextBox XEndTime = (TextBox)itm.FindControl("XEndTime");
DropDownList ddlListView = (DropDownList)itm.FindControl("ddlListView");
TextBox txtTopicDate = (TextBox)itm.FindControl("txtTopicDate");
Label lblID = (Label)itm.FindControl("lblID");
for (int i = 0; i <= objCollect.Count - 1; i++)
{
if (objCollect[i].TopicID.ToString().Equals(lblID.Text))
{
XStartTime.Text = objCollect[i].StartTime;
XEndTime.Text = objCollect[i].EndTime;
txtTopicDate.Text = objCollect[i].TopicDate;
ddlListView.SelectedValue = objCollect[i].ClassroomID.ToString();
if (!HFFacultyID.Value.Equals(objCollect[i].FacultyID))
{
txtTopicDate.Enabled = false;
XStartTime.Enabled = false;
XEndTime.Enabled = false;
ddlListView.Enabled = false;
txtTopicDate.ForeColor = System.Drawing.Color.Red;
}
else
{
txtTopicDate.Enabled = true;
XStartTime.Enabled = true;
XEndTime.Enabled = true;
ddlListView.Enabled = true;
txtTopicDate.ForeColor = System.Drawing.Color.Green;
}
}
}
}
}
}