int APP_TIME_SLOT = 5;
protected void Page_Load(object sender, EventArgs e)
{
SetTimeSlot();
}
private void SetTimeSlot()
{
SqlCommand objSqlCommand = null;
strSQL = @"SELECT Time_Slot";
objSqlCommand = new SqlCommand(strSQL, SqlConnectionObject);
string timeSlot = Convert.ToString(objSqlCommand.ExecuteScalar(objSqlCommand));
if(!string.IsNullOrEmpty(timeSlot))
{
APP_TIME_SLOT = Convert.ToInt32(timeSlot);
}
//SET TIMESLOT.READ ON CLIENT SIDE.
hidTimeSlot.Value = Convert.ToString(APP_TIME_SLOT);
}
//javascript代码
$("#contentPlaceHolderMain_btnFixAppointment").live('click', function (e)
{
alert(document.getElementById('<%=hidTimeSlot.ClientID %>').value)
}
// 我必须在客户端读取时隙值。但总是让我默认值为 5 我不知道我的代码有什么问题。