วันเสาร์ที่ 19 ธันวาคม พ.ศ. 2558

การแบ่งหน้าจาก Object ด้วย GridView แบบที่ 2

<asp:GridView ID="GridView22" runat="server"  AutoGenerateColumns="false" AllowPaging="True" AllowSorting="True" EnableViewState="true">
    <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                    <%# Eval("projectID")%>
            </ItemTemplate>           
        </asp:TemplateField>
    </Columns>
</asp:GridView>

****************************************************************************************

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If IsPostBack = False Then
            getFind(0)
        End If
End Sub

Sub getFind(PageIndex As Integer)
        Dim obj As New DataClassesABCDataContext
        GridView22.DataSource = obj.modFindData (1000)
        GridView22.PageIndex = PageIndex
        GridView22.DataBind()
End Sub

Private Sub GridView22_PageIndexChanging(sender As Object, e As GridViewPageEventArgs) Handles GridView22.PageIndexChanging
        getFind(e.NewPageIndex)

End Sub

วันอาทิตย์ที่ 13 ธันวาคม พ.ศ. 2558

การวนรอบ (Lopp) เอาข้อมูลจาก DataClasses โดย DataTable

        Dim obj As New DataClassesDataContext
        Dim dt As New DataTable
        Dim strDetail As New StringBuilder
        Dim result = obj.getCustomer_Profile_List("", "2")
        For Each p In result
            strDetail.Append(p.regUserName)

        Next

วันศุกร์ที่ 25 กันยายน พ.ศ. 2558

หาขนาดไฟล์ด้วย FileInfo



Dim fileSize As String

fileSize = New IO.FileInfo(Server.MapPath("/download/files/form_bantuek (1).doc")).Length

If fileSize >= 1048576 Then
   fileSize = FormatNumber((fileSize / 1024) / 1024, 2) & "MB."
ElseIf fileSize > 0 Then
   fileSize = FormatNumber(fileSize / 1024, 2) & "KB."

End If


วันจันทร์ที่ 21 กันยายน พ.ศ. 2558

ซ่อนและแสดง div ด้วย JavaScript เมื่อมีการคลิกที่รูปภาพ

<img id="clickMeId" src="Icons/note_add.png" onclick="show('comment')"/>
<div id="comment" style="float:left;display:none;">
    <textarea name="textfield6" cols="30" rows="2" id="Textarea1" class="text"></textarea>
    <a href="#" class="buttonintable">Submit</a>
</div>

<script type="text/javascript">
    function show(target){
    document.getElementById(target).style.display = 'block';
    document.getElementById("clickMeId").style.display = 'none';
    }
    function hide(target){
    document.getElementById(target).style.display = 'none';
    document.getElementById("clickMeId").style.display = 'block';
    }

</script>

Repeater Item Command เพื่อเรียกใช้ Control ต่างๆ ใน Repeater

Protected Sub Repeater2_ItemCommand(source As Object, e As RepeaterCommandEventArgs) Handles Repeater2.ItemCommand
        Dim rI As RepeaterItem = Me.Repeater2.Items(e.Item.ItemIndex)
        Dim txtReply As TextBox = rI.FindControl("txtReply")
        Dim ltrReply As Literal = rI.FindControl("ltrReply")
        Dim btnReply As LinkButton = rI.FindControl("btnReply")

        If e.CommandName = "btnReply" Then
            ltrReply.Text = txtReply.Text
        End If
        'If btnReply.CommandName = "" Then

        'End If

    End Sub

**********************************************
<asp:Repeater ID="Repeater2" runat="server">
<ItemTemplate>
<asp:Literal ID="ltrReply" runat="server"></asp:Literal>
<asp:TextBox ID="txtReply" runat="server" TextMode="MultiLine" </asp:TextBox>
<asp:LinkButton ID="btnReply" CommandName ="btnReply" runat="server">Post Comment</asp:LinkButton>
</ItemTemplate>
</asp:Repeater>

วันอาทิตย์ที่ 20 กันยายน พ.ศ. 2558

เติมส่วนที่ขาดหายไปของโปรแกรมคำนวณสูตรคูณต่อไปนี้ให้สมบูรณ์และถูกต้องที่สุด


Public (1)___________ Form1

   
     Private (2)__________ Button1_(3)__________ (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim total As (4)__________

        Dim i As (5)__________

        Dim s As (6)__________

        For i = 1 To (7)__________

            total = Val(TextBox1.Text) * i

            (8)__________ = s & TextBox1.Text & " x " & i & " = " & total & vbCrLf

        Next

        (9)__________(s)

    End Sub


End (10)__________

ให้ออกแบบวิธีการแก้ไขปัญหาโดยพิจารณาจากผังงานโปรแกรม อย่างใดอย่างหนึ่ง เพื่อแก้ไขปัญหาตามโจทย์ที่กำหนดให้

จากผังงาน กำหนดค่าตัวแปร  จงใช้ตอบคำถาม


2.1       กำหนดให้    A = 10  ,  B =  15                ตอบ      A  = ?   , B = ?   , C= ?   , D = ?
2.2       กำหนดให้    
A = 15  ,  B =  10                ตอบ       A  = ?   ,  B = ?   , C= ?   ,   D = ?
2.3       กำหนดให้
   A = 20  ,  B =  5                  ตอบ      A  = ?   , B = ?   , C= ?   , D = ?
2.4       กำหนดให้
   A = 10  ,  B =  15                ตอบ       A  = ?   ,  B = ?   , C= ?   ,   D = ?
2.5       กำหนดให้
   B = 10  ,  D =  15                ตอบ      A  = ?   , B = ?   , C= ?   , D = ?


 จากชุดคำสั่ง กำหนดค่าตัวแปร  จงใช้ตอบคำถาม

3.1       กำหนดให้  A1 = 1    ,  B1 =  5              ตอบ      A  = ?     , B =  ?   , Sum  =  ?    
3.2       กำหนดให้  A1 = 5    ,  B1 =  10            ตอบ      A  = ?     , B =  ?   , Sum  =  ?   
3.3
      กำหนดให้  A1 = 10  ,  B1 =  5              ตอบ      A   = ?    , B = ?    , Sum  =  ?   
3.4
      กำหนดให้  A1 = 5   ,  B1  =  5              ตอบ      A   = ?    , B = ?     , Sum =  ?   
3.5
      กำหนดให้  A1 = 5   ,  B1  =  11            ตอบ      A   = ?    , B = ?     , Sum =  ?   

 

ปลายทางของการศึกษา คืออุปนิสัยที่ดีงาม

การใช้ WebClient สำหรับเรียก URL

Dim _url As String = " https :// www . MyDomain . com /?q=ทดสอบ " Dim wc As New System . Net . WebClient () wc . Encodin...