새로 고침 없는 탄젠트 스타일 동기화 업데이트 읽지 않은 메시지 수
4395 단어 동기
<asp:Repeater ID="rptMessageList" runat="server">
<ItemTemplate>
<tr id="trReaded_<%#Eval("RecordID")%>" class="<%#getReadClass(Eval("IsRead").ToString())%>" onclick="MarkMsgRead(<%#Eval("RecordID")%>)">
<td class="messcen_tabtd1">
<asp:CheckBox ID="chkItem" runat="server" />
<asp:Label ID="lblID" Visible="false" Text='<%# DataBinder.Eval(Container.DataItem, "RecordID")%>' runat="server"></asp:Label> </td>
A.aspx
public string getReadClass(string pIsRead)
{
string mReturn = "";
if (pIsRead == "False")
mReturn = "messnoread";
return mReturn;
}
D.js
function MarkMsgRead(pRecordID) {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (err1) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (err2) {
xmlHttp = new XMLHttpRequest();
}
}
//
var mUrl = "SyschangeStyle.aspx?MsgID=" + pRecordID;
xmlHttp.open("GET", mUrl, true);
xmlHttp.onreadystatechange = OnHandlerMsg;
xmlHttp.send(null);
}
function OnHandlerMsg() {
//0 ( ): (XMLHttpRequest) , open() 。
//1 ( ): open() , 。
//2 ( ): 。
//3 ( ): 。
//4 ( ): , 。
if (xmlHttp.readyState == 4) {
var isValid = xmlHttp.responseText;
var mMsgCount = document.getElementById("_Header1_lblMsgCount");
mMsgCount.innerHTML = isValid.substring(isValid.indexOf(':') + 1, isValid.indexOf(']'));
var mTrID = isValid.substring(0, isValid.indexOf(':'));
var mTrReadID = "trReaded_" + mTrID;
var exists = document.getElementById(mTrReadID);
exists.removeAttribute("className");
}
}
B.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
int msgID = int.Parse(this.Request.QueryString["MsgID"]);
if (Request.QueryString["MsgID"] != null)
{
if (this.changeTrue(msgID))
{
string customerID = myShare.GetAObject(true, 0, "CustomerID", "Customers", "UserID='" + Session["UserID"].ToString() + "'").ToString();
int ReceiverID = int.Parse(customerID);
string mMsgCount;
mMsgCount = myShare.GetAObject(true, 0, "count(RecordID)", "MessagesRecord", "IsRead=0 and Deleted=0 and Receiver = " + customerID).ToString();
int mmMsgCount = int.Parse(mMsgCount);
Response.Write(msgID + ":" + mMsgCount + ']');
}
else
{
Response.Write(msgID + "messnoread; ");
}
}
else
{
Response.Write(" ");
}
}
private bool changeTrue(int pmsgID)
{
return myShare.SetAField(0, "IsRead", "1", "MessagesRecord", "RecordID=" + pmsgID) != null ? true : false;
}
C.ascx
<i>(<a href="SysMessageOld.aspx" title=" "><asp:Label ID="lblMsgCount" runat="server"></asp:Label></a>)</i>
C.ascx.cs
string customerID = myShare.GetAObject(true, 0, "CustomerID", "Customers", "UserID='" + Session["UserID"].ToString() + "'").ToString();
int ReceiverID = int.Parse(customerID);
lblMsgCount.Text = myShare.GetAObject(true, 0, "count(RecordID)", "MessagesRecord", "IsRead=0 and Deleted=0 and Receiver = " + customerID).ToString();
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
모던 자바스크립트 복습 #3React로 넘어가기 전에 빠르게 JavaScript를 복습해본다. 동기적 처리와 비동기적 처리에 대해 알아보자. 특정 함수가 끝난 다음에 어떤 작업을 처리하고 싶다면 callback함수를 파라미터로 전달해주면 된다...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.