Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > ASP > ASP Forum > จากฏค้ดนี้นะค่ะสอบถามการใส่ paging แสดงผลครั้งละ 2 record ใน Aspajax edit/update นะค่ะ ต้องปรับตัวไหนให้แสดงผลได้คะ



 

จากฏค้ดนี้นะค่ะสอบถามการใส่ paging แสดงผลครั้งละ 2 record ใน Aspajax edit/update นะค่ะ ต้องปรับตัวไหนให้แสดงผลได้คะ

 



Topic : 081470



โพสกระทู้ ( 55 )
บทความ ( 0 )



สถานะออฟไลน์




Code (ASP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>
<head>
<title>ThaiCreate.Com Ajax Tutorial</title>
</head>
<script language="JavaScript">
	   var HttPRequest = false;

	   function doCallAjax(Mode) {
		  HttPRequest = false;
		  if (window.XMLHttpRequest) { // Mozilla, Safari,...
			 HttPRequest = new XMLHttpRequest();
			 if (HttPRequest.overrideMimeType) {
				HttPRequest.overrideMimeType('text/html');
			 }
		  } else if (window.ActiveXObject) { // IE
			 try {
				HttPRequest = new ActiveXObject("Msxml2.XMLHTTP");
			 } catch (e) {
				try {
				   HttPRequest = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			 }
		  } 
		  
		  if (!HttPRequest) {
			 alert('Cannot create XMLHTTP instance');
			 return false;
		  }
	
		  var url = 'Ajaxaspupdate.asp';

		  if(Mode == "UPDATE")
		  {
			  var pmeters = "tCustomerID=" + encodeURI( document.getElementById("txtCustomerID").value) +
							"&tName=" + encodeURI( document.getElementById("txtName").value ) +
							"&tEmail=" + encodeURI( document.getElementById("txtEmail").value ) +
							"&tCountryCode=" + encodeURI( document.getElementById("txtCountryCode").value ) +
							"&tBudget=" + encodeURI( document.getElementById("txtBudget").value ) +
							"&tUsed=" + encodeURI( document.getElementById("txtUsed").value ) +
							"&tMode=" + Mode;
		  }

		  if(Mode == "LIST")
		  {
			var pmeters = "";
		  }

			HttPRequest.open('post',url,true);

			HttPRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			HttPRequest.setRequestHeader("Content-length", pmeters.length);
			HttPRequest.send(pmeters);
			
			
			HttPRequest.onreadystatechange = function()
			{

				 if(HttPRequest.readyState == 3)  // Loading Request
				  {
				   document.getElementById("mySpan").innerHTML = "Now is Loading...";
				  }

				 if(HttPRequest.readyState == 4) // Return Request
				  {
				   document.getElementById("myForm").style.display = 'none';

				   document.getElementById("txtCustomerID").value = '';
				   document.getElementById("txtName").value = '';
				   document.getElementById("txtEmail").value = '';
				   document.getElementById("txtCountryCode").value = '';
				   document.getElementById("txtBudget").value = '';
				   document.getElementById("txtUsed").value = '';

				   document.getElementById("mySpan").innerHTML = HttPRequest.responseText;

				  }
				
			}

	   }

	   function ShowEdit(sCustomerID,sName,sEmail,sCountryCode,sBudget,sUsed)
	   {
			
			document.getElementById("myForm").style.display = '';

			document.getElementById("txtCustomerID").value = sCustomerID;
			document.getElementById("txtName").value = sName;
			document.getElementById("txtEmail").value = sEmail;
			document.getElementById("txtCountryCode").value = sCountryCode;
			document.getElementById("txtBudget").value = sBudget;
			document.getElementById("txtUsed").value = sUsed;			
	   }
	</script>
<body Onload="JavaScript:doCallAjax('LIST');">
<h1>My Customer</h1>
<form name="frmMain">
<span id="myForm" style="display='none';">
<table width="640" border="1">
  <tr>
    <th width="91"> <div align="center">CustomerID</div></th>
    <th width="98"> <div align="center">Name</div></th>
    <th width="198"> <div align="center">Email</div></th>
    <th width="97"> <div align="center">CountryCode</div></th>
    <th width="59"> <div align="center">Budget</div></th>
    <th width="71"> <div align="center">Used</div></th>
  </tr>
  <tr>
	<td><div align="center"><input type="text" name="txtCustomerID" id="txtCustomerID" size="5" disabled="true"></div></td>
	<td><input type="text" name="txtName" id="txtName" size="20"></td>
	<td><input type="text" name="txtEmail" id="txtEmail" size="20"></td>
	<td><div align="center"><input type="text" name="txtCountryCode" id="txtCountryCode" size="2"></div></td>
	<td align="right"><input type="text" name="txtBudget" id="txtBudget" size="5"></td>
	<td align="right"><input type="text" name="txtUsed" id="txtUsed" size="5"></td>
  </tr>
</table>
<input type="button" name="btnUpdate" id="btnUpdate" value="Update" OnClick="JavaScript:doCallAjax('UPDATE');">
<br><br></span>
<span id="mySpan"></span>
</form>
</body>
</html><%
Dim strMode

strMode = Request.Form("tMode")

Dim Conn,strSQL,objExec,objRec
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("mydatabase.mdb"),"" , ""

If strMode = "UPDATE" Then
	strSQL = "UPDATE customer SET "
	strSQL = strSQL&"Name = '"&Request.Form("tName")&"' "
	strSQL = strSQL&",Email = '"&Request.Form("tEmail")&"' "
	strSQL = strSQL&",CountryCode = '"&Request.Form("tCountryCode")&"' "
	strSQL = strSQL&",Budget = '"&Request.Form("tBudget")&"' "
	strSQL = strSQL&",Used = '"&Request.Form("tUsed")&"' "
	strSQL = strSQL&"WHERE CustomerID = "&Request.Form("tCustomerID")&" "
	Set objExec = Conn.Execute(strSQL)
End IF


strSQL = "SELECT * FROM customer "
Set objRec = Server.CreateObject("ADODB.Recordset")
objRec.Open strSQL, Conn, 1,3
%>

<table width="640" border="1">
  <tr>
    <th width="91"> <div align="center">CustomerID</div></th>
    <th width="98"> <div align="center">Name</div></th>
    <th width="198"> <div align="center">Email</div></th>
    <th width="97"> <div align="center">CountryCode</div></th>
    <th width="59"> <div align="center">Budget</div></th>
    <th width="71"> <div align="center">Used</div></th>
    <th width="40"> <div align="center">Edit</div></th>
  </tr>
<%
While Not objRec.EOF
%>
  <tr>
	<td><div align="center"><%=objRec.Fields("CustomerID").Value%></div></td>
	<td><%=objRec.Fields("Name").Value%></td>
	<td><%=objRec.Fields("Email").Value%></td>
	<td><div align="center"><%=objRec.Fields("CountryCode").Value%></div></td>
	<td align="right"><%=objRec.Fields("Budget").Value%></td>
	<td align="right"><%=objRec.Fields("Used").Value%></td>
    <td align="center"><a href="JavaScript:ShowEdit('<%=objRec.Fields("CustomerID").Value%>', '<%=objRec.Fields("Name").Value%>','<%=objRec.Fields("Email")%>', '<%=objRec.Fields("CountryCode")%>','<%=objRec.Fields("Budget")%>', '<%=objRec.Fields("Used")%>')">Edit</a></td>
  </tr>
<%
objRec.MoveNext
Wend
%>
</table>
<%
objRec.Close()
Conn.Close()
Set objRec = Nothing
Set Conn = Nothing
%>




Tag : ASP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-07-24 11:50:10 By : typex View : 1505 Reply : 1
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ใช้แบบปกติดีกว่าครับ Ajax เขียนยากซับซ้อนครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-07-24 21:10:01 By : mr.win
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : จากฏค้ดนี้นะค่ะสอบถามการใส่ paging แสดงผลครั้งละ 2 record ใน Aspajax edit/update นะค่ะ ต้องปรับตัวไหนให้แสดงผลได้คะ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่