我写了个用户控件ShowLoginBar,在内容页给用户控件的属性toURL赋了值,但是用户控件自身调用这个值的时候toURL的值却为空。我是菜鸟,大家多多帮忙啊!急急急急急急急!
自定义控件ShowLoginBar.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.IO;
using System.Web.Security;
namespace TraineeManagementSystem.Include.Ascx
{
public partial class ShowLoginBar : System.Web.UI.UserControl
{
public string RootPath;
private string toURL;
/// <summary>
/// toURL弹出登录框跳转的路径
/// </summary>
public string ToURL
{
get { return toURL; }
set { toURL = value; }
}
private string thisURL;
/// <summary>
/// toURL弹出登录框跳转的路径
/// </summary>
public string ThisURL
{
get { return toURL; }
set { toURL = value; }
}
private static string thisToUrl;
protected void Page_Load(object sender, EventArgs e)
{
RootPath = TraineeManagementSystem.Code.GetFilePath._ApplicationPath;
}
protected void lnkPWD_Click(object sender, EventArgs e)
{
Session["tabNumber"] = "3";
Response.Redirect("aq.aspx");
}
protected void btnLogin_Click(object sender, EventArgs e)
{
//创建链接字符串
string conStr = ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString;
//创建数据库链接
SqlConnection con = new SqlConnection(conStr);