|
|
|
ถามเรื่องวิธีเลือกรูปโดยวางไว้บน panel ค่ะ สวัสดีค่ะ ^^ คือจะถามเรื่อง การ เลือกรูป 4 รูปที่วางอยู่บนแต่ละpanel โดยใช้ปุ่ม prevoius |
|
|
|
|
|
|
|
ผิดตรงเมื่อเกิด event page load เจ้า count จะถูก set ให้เป็น 1 ทุกครั้งไง
กด next มันเลยได้อีก +1 เลยเท่ากับ 2
Code (VB.NET)
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Data.SqlClient"%>
<%@Import Namespace="System.IO" %>
<%@ Page Language="VB" %>
<script runat="server">
Private Dim count As Integer
Sub Page_Load(sender As Object, e As EventArgs)Handles Me.Load
If Request.QueryString("page") Is Nothing Then
count = 1
Else
count = CInt(Request.QueryString("page").ToString())
End If
state.Text = count.ToString()
Select Case count
Case 1
button1.Visible = False
button2.Visible = True
Me.pnlAdd1.Visible = True
Me.pnlAdd2.Visible = False
Me.pnlAdd3.Visible = False
Me.pnlAdd4.Visible = False
Case 2
button1.Visible = True
button2.Visible = True
Me.pnlAdd2.Visible = True
Me.pnlAdd1.Visible = False
Me.pnlAdd3.Visible = False
Me.pnlAdd4.Visible = False
Case 3
button1.Visible = True
button2.Visible = True
Me.pnlAdd3.Visible = True
Me.pnlAdd2.Visible = False
Me.pnlAdd1.Visible = False
Me.pnlAdd4.Visible = False
Case Else
button1.Visible = True
button2.Visible = False
Me.pnlAdd4.Visible = True
Me.pnlAdd2.Visible = False
Me.pnlAdd3.Visible = False
Me.pnlAdd1.Visible = False
End Select
End Sub
Sub btnPrevious(sender As Object, e As EventArgs)
count = count - 1
If count < 1 Then
count = 1
End If
Response.Redirect("ชื่อไฟล์.aspx?page=" & count.ToString())
End Sub
Sub btnNext(sender As Object, e As EventArgs)
count = count + 1
If count > 4 Then
count = 4
End If
Response.Redirect("ชื่อไฟล์.aspx?page=" & count.ToString())
End Sub
</script>
<form runat="server">
<asp:Button id="button1" Text="previous" Onclick="btnPrevious" runat="server"/>
<asp:TextBox id="state" runat="server" Width="15px"></asp:TextBox>
<asp:Label id="total" runat="server" text="\4"></asp:Label>
<asp:Button id="button2" Text="next" Onclick="btnNext" runat="server"/>
<asp:panel id="pnlAdd1" runat="server"><embed src="testxml2.swf" quality="high" bgcolor="#ffffff" width="500" height="380" name="testxml2" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</asp:panel>
<asp:panel id="pnlAdd2" runat="server"><embed src="testxml2.swf" quality="high" bgcolor="#ffffff" width="500" height="380" name="testxml2" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</asp:panel>
<asp:panel id="pnlAdd3" runat="server"><embed src="testxml2.swf" quality="high" bgcolor="#ffffff" width="500" height="380" name="testxml2" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</asp:panel>
<asp:panel id="pnlAdd4" runat="server"><embed src="testxml2.swf" quality="high" bgcolor="#ffffff" width="500" height="380" name="testxml2" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</asp:panel>
</form>
พยายามฝึกทำฝึกคิดเยอะๆ จะได้คิด algoritm ออก
|
|
|
|
|
Date :
2010-03-04 08:36:28 |
By :
tungman |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|