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 > สอบถามเรื่องการแบ่งหน้า เปลี่ยนหน้าไปแล้ว เลือก listmenu แล้วมันเด้งกลับค่าเดิมครับ



 

สอบถามเรื่องการแบ่งหน้า เปลี่ยนหน้าไปแล้ว เลือก listmenu แล้วมันเด้งกลับค่าเดิมครับ

 



Topic : 076246



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



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




สอบถามเรื่องการแบ่งหน้าครับ ทำการแบ่งหน้าได้ปรกติครับ แต่ถ้าหากเปลี่ยน จากหน้า 1 ไปหน้า 2 หรือหน้าใดๆแล้ว
แล้วกลับมาเลือก listmenu ใหม่ แล้วทำการกดค้นหาข้อมูล มันจะเด้งกลับไปค่าเดิมก่อนหน้านี้น่ะครับ
เหมือนว่ามันจำค่า listmenu ค่าเดิมเอาไว้ แต่ถ้าไม่เปลี่ยนหน้า ก็จะเลือก listmenu ได้ปรกติครับ ไม่ทราบว่าจะแก้ไข
ปัญหาตรงนี้ได้อย่างไรครับ ขอบคุณครับ
Code (ASP)
<table width="100%" border="0" cellspacing="2" cellpadding="0" class="myfont" style="border:#CCCCCC dotted 1px">
  <form name="form1" method="post" action="">
  <tr>
    <td align="center">ตั้งแต่วันที่
        <input name="startdate" type="text" id="startdate" size="10" value="<%=isdateNtime(startdate)%>" readonly style="background-color:#CCCCCC">
        <INPUT name="button" type=button class="d1" onClick="gfPop.fStartPop(this.form.startdate,this.form.enddate);"  >ถึง
      
        <input name="enddate" type="text" id="enddate" size="10" value="<%=isdateNtime(enddate)%>" readonly style="background-color:#CCCCCC">
      <INPUT name="button" type=button class="d1" onClick="gfPop.fEndPop(this.form.startdate,this.form.enddate);" >
      &nbsp;  
<!--- ส่วนการเลือก listmenu เพื่อค้นหา --->
        <select name="subp" id="subp" >
        <%
		
			set Rs= Server.CreateObject("ADODB.Recordset")
			sql1 = "Select * From site_Organize1  order by code"
			Rs.Open sql1, MM_data_STRING ,1 ,1 
			if not rs.eof then
			while not  rs.eof 
			%>
          <option value="<%=rs("name")%>"  <%if subp=rs("name") then response.Write("selected") end if%>><%=rs("name")%></option>
          <%
		  rs.movenext
		  wend
		  end if
		  rs.close()
		set rs=nothing
		  %>
        </select>
      <input type="submit" name="Submit" id="Submit" value="Submit"></td>
  </tr>
  </form>
</table>

 <table width="100%" border="0" align="left" cellpadding="6" cellspacing="1" class="myfont">
  <tr bgcolor="#0066CC" class="clsCMVOn">
    <td align="center">ลำดับ</td>
    <td width="729" height="25"><div align="center">ชื่อเนื้อหา</div></td>
    <td width="136" align="center">จำนวนผู้เข้าชม</td>
  </tr>
    <%
			 PageSize=20	
			if Request.QueryString("PageNo")="" then        
				PageNo=1        
			else            
				PageNo=cint(Request.QueryString("PageNo"))        
			end if

				if isdate(startdate) and isdate(enddate) then
				    sqll=" where dirname <>'' and logdate between '"&startdate&" 00:00:01' and '"&enddate&" 23:59:59' "
				else
		        	sqll=" where dirname <>'' and logdate between '"&startdate&" 00:00:01' and '"&enddate&" 23:59:59' "
				end if
			
			if request("subp")<>"" then
			sqllp=" and pagename='"&request("subp")&"' "
			else
			sqllp=" and pagename='"&subp_de&"' "
			end if
	    Set rs = Server.CreateObject("ADODB.Recordset")
  	    sql1="select  name,count(id) as aa  from content_Log "&sqll&" "&sqllp&"   group by name order by aa desc"
		
		redim color(2) : color(0)="#FFFFFF" : color(1)="#F0FFFF"
        rs.Open sql1, MM_data_STRING,1 ,1
			if not rs.eof then
			
				Rs.PageSize=PageSize												
				PageCount=cint(Rs.PageCount)					
				Rs.AbsolutePage=PageNo										

            end if
		    nID=1 :while not Rs.eof and nID<=PageSize
			qrey="&startdate="&startdate&"&enddate="&enddate&"&subp="&request("subp")
			%>
   <tr bgcolor="<%=color(c)%>" onMouseOver="this.style.background='#FFFF99';" onMouseOut="this.style.background='<%=color(c)%>'" >
    <td width="72" align="center"><%=(pagesize*(pageno-1))+nID%></td>
    
    <td><b><%=rs("name")%></b></td>
    
    <td align="center"><%=rs("aa")%></td>
  </tr>
                <%	nID=nID+1
                if c=1 then c=0 else c=1 end if 
				rs.movenext
		   wend
		   if rs.recordcount >0 then
		      rs.movefirst
		   end if%>

  <tr align="right" class="myfont">
    <td colspan="7">ทั้งหมด &nbsp; <b><%=Rs.recordcount%></b>&nbsp;รายการ
    <%

Response.Write(" &nbsp; [")

	If PageNo > 1 Then 'สร้างลิ๊งก์ <<Frist , <Prev
		Response.Write vbCrLf &"<a href=report_content.asp?PageNo=1"&qrey&"><<</a>"
		Response.Write vbCrLf &"<a href=report_content.asp?PageNo="&PageNo-1&qrey&"><</a>"   	     	
	End If     
 
 		 LRPages = 4 
		 TotalPageCount = PageCount	      

	             if PageCount > 10 then
				        PageCount = 10 

		               if PageNo > PageCount then 'ในกรณีที่ current page มากกว่าเพจที่ 10

					          if request("Rscommentall") = "" then
					                intForLoopToRscommentAllPages = PageNo -  LRPages 

								       if TotalPageCount - PageNo <=  LRPages then
						     		         PageCount = TotalPageCount - PageNo
										
								             PageCount = PageNo + PageCount
								       else
								             PageCount = PageNo + LRPages
								       end if

                             else
							      intForLoopToRscommentAllPages = PageNo -  LRPages
								  PageCount = TotalPageCount
							 end if	    

			     		else

						          if request("Rscommentall") = "" then
				         	           intForLoopToRscommentAllPages = 1
                                  else
							           intForLoopToRscommentAllPages = PageNo 
								       PageCount = TotalPageCount
							      end if	    
					    end if
                   else
					 intForLoopToRscommentAllPages = 1	
                   end if
		   
	If PageNo > 1 or NOT Rs.EOF Then									
		for intLinkPageNum = intForLoopToRscommentAllPages to PageCount
			If intLinkPageNum = PageNo Then						
				Response.Write vbCrLf&"<b>"&intLinkPageNum&"</b>"
			else
				Response.Write vbCrLf & "&nbsp;<a href=report_content.asp?PageNo="&intLinkPageNum&qrey&">" & intLinkPageNum & "</a>"			
			end If
		next
	end If
	
	If NOT rs.EOF and PageNo<>TotalPageCount and request.QueryString("Rscommentall")<>"yes" then   	'สร้างลิ๊งก์ Next> ,Last>>
		Response.Write vbCrLf & "&nbsp;<a href=report_content.asp?PageNo="&PageNo+1&qrey&">></a>"
		Response.Write vbCrLf & "&nbsp;<a href=report_content.asp?PageNo="&TotalPageCount &qrey&">>></a>"
	end If
	
	if TotalPageCount > 10 and request.QueryString("Rscommentall")<>"yes"then
		Response.Write vbCrLf & "&nbsp;<a href=report_content.asp?PageNo=1&Rscommentall=yes"&qrey&">...</a>"
	end If
Response.Write(" ]") 
rs.close() %></td>
  </tr>
</table>






Tag : ASP, Ms SQL Server 2008









ประวัติการแก้ไข
2012-03-28 10:58:43
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-03-28 10:53:31 By : altrakung View : 1535 Reply : 2
 

 

No. 1



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

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

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

เวลาจะ submit ไปอีกรอบคุณจะต้องส่งค่า ที่กำลังทำงานอยู่ในขณะนั้นด้วยครับ เช่นพวกตัวแปรต่างๆ อาจจะส่งผ่าน hidden หรือ querystring






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-03-28 16:41:14 By : webmaster
 


 

No. 2



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



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


ขอบคุณสำหรับคำแนะนำครับ

ตอนนี้แก้ปัญหาได้แล้วครับ เอา javascript เข้ามาช่วย
Code (JavaScript)
<script language="JavaScript" type="text/JavaScript">
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>


Code (ASP)
<select name="jumpMenu" id="jumpMenu" onChange="MM_jumpMenu('self',this,0)">
         <option value="in_reportcontent.asp?pagename=""">ทั้งหมด</option>
        <%set Rs= Server.CreateObject("ADODB.Recordset")
			sql1 = "Select * From site_Organize1  order by code"
			Rs.Open sql1, MM_data_STRING ,1 ,1 
			if not rs.eof then
			while not  rs.eof 
			%>
          <option value="in_reportcontent.asp?pagename=<%=rs("name")%>"  <%if num(request("name"))=rs("name") then response.Write("selected") end if%>><%=rs("name")%></option>
          <%
		  rs.movenext
		  wend
		  end if
		  rs.close()
		set rs=nothing
		  
		  %>
        </select>



ประวัติการแก้ไข
2012-03-28 17:10:30
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-03-28 17:09:52 By : altrakung
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : สอบถามเรื่องการแบ่งหน้า เปลี่ยนหน้าไปแล้ว เลือก listmenu แล้วมันเด้งกลับค่าเดิมครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 03
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 อัตราราคา คลิกที่นี่