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 > .NET Framework > Forum > ฟังชั่น reponsive gridview ไม่ทำงานครับหาวิธีแก้ แต่ทำไม่ได้ รบกวนขอคำชี้เเนะด้วยครับ



 

ฟังชั่น reponsive gridview ไม่ทำงานครับหาวิธีแก้ แต่ทำไม่ได้ รบกวนขอคำชี้เเนะด้วยครับ

 



Topic : 120431



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



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




เนื่องจากผมกำลังศึกษาการใช้งาน reponsive gridview ได้ตัวอย่างจากเว็บนี้
http://www.aspsnippets.com/Articles/Bootstrap-Responsive-GridView-for-Mobile-Phone-Tablet-and-Desktop-display-in-ASPNet-using-jQuery.aspx

ปรากฏว่าสามารถทำงานได้ครับแต่ หลังจาก กด เลือกหน้าทำให้เกิดปัญหา reponsive ไม่ทำงาน ตามตัวอย่างข้างล่างนี้เลยครับ
รบกวนขอคำแนะนำแก้ปัญหาเวลากดเลือกหน้าให้โค้ดทำงานด้วยครับ คาดว่าน่าจะเกิดจากการไม่ทำงานเวลาเพจดิ่ง ลองมาหลายวิธีแล้วแต่เเก้ไม่ได้ครับ

ทำงาน
work

ไม่ทำงาน
don't work

Code (VB.NET)
on.TableHeader
    End Sub
Imports AjaxControlToolkit
Imports System.Data
Imports System.Data.SqlClient
Public Class WebForm1
    Inherits System.Web.UI.Page
    Dim con As New SqlConnection("Data Source=ERP;Initial Catalog=account_org2;Persist Security Info=True;User ID=sa;Password=@rc1982")
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Me.IsPostBack Then
            GridView1.DataBind()
            command()
        End If
    End Sub

    Protected Sub LinkButton1_Click(sender As Object, e As EventArgs)
        command()
        Dim btnsubmit As LinkButton = TryCast(sender, LinkButton)
        Dim gRow As GridViewRow = DirectCast(btnsubmit.NamingContainer, GridViewRow)
        lblbarcode.Text = GridView1.DataKeys(gRow.RowIndex).Value.ToString()
        If Not IsDBNull(Convert.ToString(gRow.Cells(3))) Or Not IsDBNull(gRow.Cells(3).Text) Then
            lblbarcode.Text = gRow.Cells(0).Text
            txtbarcodetext.Text = gRow.Cells(1).Text
            txtproductcode.Text = gRow.Cells(2).Text
            DropDownList2.SelectedIndex = -1
            txtlocation.Text = gRow.Cells(4).Text
            Me.ModalPopupExtender1.Show()
        Else
            lblbarcode.Text = gRow.Cells(0).Text
            txtbarcodetext.Text = gRow.Cells(1).Text
            txtproductcode.Text = gRow.Cells(2).Text
            DropDownList2.Text = gRow.Cells(3).Text
            txtlocation.Text = gRow.Cells(4).Text
            Me.ModalPopupExtender1.Show()
        End If
    End Sub
    Protected Sub btnModity_Click(sender As Object, e As EventArgs) Handles btnUpdate.Click
        Dim BARCODE As String = lblbarcode.Text
        con.Open()
        Dim cmd As New SqlCommand("update csbarcode set barcodetext='" + txtbarcodetext.Text + "', productcode='" + txtproductcode.Text + "', unitcode='" + DropDownList2.text + "', location='" + txtlocation.Text + "' where barcode=" + "'" + BARCODE + "'", con)
        cmd.ExecuteNonQuery()
        con.Close()
        Dim msg = "อัพเดทเสร็จสมบูรณ์ !!!"
        Dim title = "แจ้งการอัพเดท"
        MsgBox(msg, MsgBoxStyle.OkOnly, title)
        GridView1.DataBind()
    End Sub
    Protected Sub Button3_Click(sender As Object, e As EventArgs) Handles btnInsert.Click
        Me.ModalPopupExtender2.Show()
    End Sub

    Protected Sub btnSearch_Click(sender As Object, e As EventArgs) Handles btnSearch.Click
        Dim searchword As String
        searchword = "select*from csbarcode where barcode like '%" + txtsearch.Text.ToString() + "%'" & _
            "or barcodetext like '%" + txtsearch.Text.ToString() + "%'" & _
            "or productcode like '%" + txtsearch.Text.ToString() + "%'"
        SqlDataSource.SelectCommand = searchword
        GridView1.DataBind()
        command()
    End Sub

    Protected Sub Add_Click(sender As Object, e As EventArgs) Handles Add.Click
        If txtinserbarcode.Text <> "" Then
            Dim strSQL As String
            strSQL = "insert into CSBARCODE (BARCODE,BARCODETEXT,PRODUCTCODE,UNITCODE,CLOSEFLAG,TRFLAG,ROWORDER,SYSDOCFLAG,Location) values ('" & txtinserbarcode.Text & "','" & txtinsertbarcodetext.Text & "','" & txtinsertbarcodetext.Text & "','" & DropDownList2.Text & "','0','1','0','0','" & txtinsertlocation.Text & "')"
            con.Open()
            Dim cmd As New SqlCommand(strSQL, con)
            cmd.ExecuteNonQuery()
            con.Close()
            Dim msg = "เพิ่มข้อมูลสำเร็จ"
            Dim title = "แจ้งการเพิ่มข้อมูล"
            MsgBox(msg, MsgBoxStyle.OkOnly, title)
        Else
            Dim msg = "กรุณากรอกข้อมูลให้ครบถ้วน"
            Dim title = "แจ้งการกรอกข้อมูล"
            MsgBox(msg, MsgBoxStyle.OkOnly, title)
        End If
    End Sub
    Sub command()
            GridView1.HeaderRow.Cells(0).Attributes("data-class") = "expand"
            'Attribute to hide column in Phone.
            GridView1.HeaderRow.Cells(2).Attributes("data-hide") = "phone"
            GridView1.HeaderRow.Cells(3).Attributes("data-hide") = "phone"
            GridView1.HeaderRow.Cells(4).Attributes("data-hide") = "phone"
            'Adds THEAD and TBODY to GridView.
            GridView1.HeaderRow.TableSection = TableRowSection.TableHeader
    End Sub

End Class
End Class

Code (ASP)
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="defualt.aspx.vb" Inherits="test_popup_and_responsive.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/jquery-footable/0.1.0/css/footable.min.css"
    rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-footable/0.1.0/js/footable.min.js"></script>
<script type="text/javascript">
    $(function () {
        $('[id*=GridView1]').footable();
    });
</script>
    <style type="text/css">
        .auto-style1 {
            text-align: center;
        }
        .auto-style2 {
            text-align: center;
            width: 135px;
        }
        .auto-style3 {
            width: 144px;
        }
        .auto-style4 {
            width: 139px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    
        <asp:Button ID="btnInsert" runat="server" Height="21px" Text="เพิ่มข้อมูล" />
        <br />
        <asp:TextBox ID="txtsearch" runat="server"></asp:TextBox>
        &nbsp;<asp:Button ID="btnSearch" runat="server" Height="22px" style="margin-top: 0px" Text="ค้นหา" />
    
        <asp:GridView ID="GridView1" 
            CssClass="footable"
            runat="server" AllowPaging="True" AutoGenerateColumns="False"
            DataKeyNames="BARCODE" DataSourceID="SqlDataSource" Width="794px">
            <Columns>
                <asp:BoundField DataField="BARCODE" HeaderText="BARCODE" ReadOnly="True" SortExpression="BARCODE"  ItemStyle-Width="90">
<ItemStyle Width="90px"></ItemStyle>
                </asp:BoundField>
                <asp:BoundField DataField="BARCODETEXT" HeaderText="BARCODETEXT" SortExpression="BARCODETEXT" ItemStyle-Width="90">
<ItemStyle Width="90px"></ItemStyle>
                </asp:BoundField>
                <asp:BoundField DataField="PRODUCTCODE" HeaderText="PRODUCTCODE" SortExpression="PRODUCTCODE" />
                <asp:BoundField DataField="UNITCODE" HeaderText="UNITCODE" SortExpression="UNITCODE" />
                <asp:BoundField DataField="LOCATION" HeaderText="LOCATION" SortExpression="LOCATION" />
                <asp:TemplateField HeaderText="แก้ไข" >
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">แก้ไข</asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <PagerSettings Mode="NumericFirstLast" />
        </asp:GridView>
        <br />
        <asp:SqlDataSource ID="SqlDataSource" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:ACCOUNT_ORG2ConnectionString %>" DeleteCommand="DELETE FROM [CSBARCODE] WHERE [BARCODE] = @original_BARCODE AND (([BARCODETEXT] = @original_BARCODETEXT) OR ([BARCODETEXT] IS NULL AND @original_BARCODETEXT IS NULL)) AND (([PRODUCTCODE] = @original_PRODUCTCODE) OR ([PRODUCTCODE] IS NULL AND @original_PRODUCTCODE IS NULL)) AND (([UNITCODE] = @original_UNITCODE) OR ([UNITCODE] IS NULL AND @original_UNITCODE IS NULL)) AND (([LOCATION] = @original_LOCATION) OR ([LOCATION] IS NULL AND @original_LOCATION IS NULL))" InsertCommand="INSERT INTO [CSBARCODE] ([BARCODE], [BARCODETEXT], [PRODUCTCODE], [UNITCODE], [LOCATION]) VALUES (@BARCODE, @BARCODETEXT, @PRODUCTCODE, @UNITCODE, @LOCATION)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [BARCODE], [BARCODETEXT], [PRODUCTCODE], [UNITCODE], [LOCATION] FROM [CSBARCODE]" UpdateCommand="UPDATE [CSBARCODE] SET [BARCODETEXT] = @BARCODETEXT, [PRODUCTCODE] = @PRODUCTCODE, [UNITCODE] = @UNITCODE, [LOCATION] = @LOCATION WHERE [BARCODE] = @original_BARCODE AND (([BARCODETEXT] = @original_BARCODETEXT) OR ([BARCODETEXT] IS NULL AND @original_BARCODETEXT IS NULL)) AND (([PRODUCTCODE] = @original_PRODUCTCODE) OR ([PRODUCTCODE] IS NULL AND @original_PRODUCTCODE IS NULL)) AND (([UNITCODE] = @original_UNITCODE) OR ([UNITCODE] IS NULL AND @original_UNITCODE IS NULL)) AND (([LOCATION] = @original_LOCATION) OR ([LOCATION] IS NULL AND @original_LOCATION IS NULL))">
            <DeleteParameters>
                <asp:Parameter Name="original_BARCODE" Type="String" />
                <asp:Parameter Name="original_BARCODETEXT" Type="String" />
                <asp:Parameter Name="original_PRODUCTCODE" Type="String" />
                <asp:Parameter Name="original_UNITCODE" Type="String" />
                <asp:Parameter Name="original_LOCATION" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="BARCODE" Type="String" />
                <asp:Parameter Name="BARCODETEXT" Type="String" />
                <asp:Parameter Name="PRODUCTCODE" Type="String" />
                <asp:Parameter Name="UNITCODE" Type="String" />
                <asp:Parameter Name="LOCATION" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="BARCODETEXT" Type="String" />
                <asp:Parameter Name="PRODUCTCODE" Type="String" />
                <asp:Parameter Name="UNITCODE" Type="String" />
                <asp:Parameter Name="LOCATION" Type="String" />
                <asp:Parameter Name="original_BARCODE" Type="String" />
                <asp:Parameter Name="original_BARCODETEXT" Type="String" />
                <asp:Parameter Name="original_PRODUCTCODE" Type="String" />
                <asp:Parameter Name="original_UNITCODE" Type="String" />
                <asp:Parameter Name="original_LOCATION" Type="String" />
            </UpdateParameters>
        </asp:SqlDataSource>
    
         <asp:Button ID="modelPopup" runat="server" style="display:none" />
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="modelPopup" PopupControlID="updatePanel"
CancelControlID="btnCancel" BackgroundCssClass="tableBackground">
</ajaxToolkit:ModalPopupExtender>
    <br />
<asp:Panel ID="updatePanel" runat="server" BackColor="White" Height="357px" Width="300px" style="display:none">
<table cellspacing="4" class="footable">
	<tr style="background-color:#33CC66">
	<td colspan="2"   class="auto-style1" ><center>แก้ไข <strong>Barcode </strong></center></td>
	</tr>
	<tr>
		<td align="right" style=" width:45%">
		Barcode:
		</td>
		<td class="auto-style4">
		<asp:Label ID="lblbarcode" runat="server"></asp:Label>
		</td>
	</tr>
	<tr>
		<td align="right">
		    ชื่อบาร์ดโคด้:
		</td>
		<td class="auto-style4">
		<asp:TextBox ID="txtbarcodetext" runat="server" Width="110px"/>
		</td>
	</tr>
	<tr>
		<td align="right">
		    รหัสบาร์ดโค้ด:
		</td>
		<td class="auto-style4">
		<asp:TextBox ID="txtproductcode" runat="server" Width="110px"/>
		</td>
	</tr>
	<tr>
		<td align="right">
		    หน่วยนับ:
		</td>
		<td class="auto-style4">
		    <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="unit" DataTextField="CODE" DataValueField="CODE" Width="120px">
            </asp:DropDownList>
            <asp:SqlDataSource ID="unit" runat="server" ConnectionString="<%$ ConnectionStrings:workConnectionString %>" SelectCommand="SELECT DISTINCT [CODE] FROM [CSUNIT]"></asp:SqlDataSource>
		</td>
	</tr>
	<tr>
		<td align="right">
		    สถานที่:
		</td>
		<td class="auto-style4">
		<asp:TextBox ID="txtlocation" runat="server" Width="111px"/>
		</td>
	</tr>
	<tr>
		<td align=right >
		<asp:Button ID="btnUpdate" CommandName="Update" runat="server" Text="Update Data" Width="103px" />
		</td>
		<td class="auto-style4">
		<center><asp:Button ID="btnCancel" runat="server" Text="Cancel" /></center>
		</td>
	</tr>
</table>
</asp:Panel>

<asp:Button ID="modelpopup2" runat="server" style="display:none" />
    <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender2" runat="server" TargetControlID="modelpopup2" PopupControlID="Panel1"
    CancelControlID="cancle" BackgroundCssClass="tableBackground">
    </ajaxToolkit:ModalPopupExtender>
    <asp:Panel ID="Panel1" runat="server" BackColor="White" Height="366px" Width="300px" style="display:none">
<table cellspacing="4" class="footable">
	<tr style="background-color:#33CC66">
	<td colspan="2"  align="center"><center><strong>เพิ่ม Barcode</strong></center></td>
	</tr>
	<tr>
		<td align="right" class="auto-style2">
		Barcode:
		</td>
		<td class="auto-style3">
		    <asp:TextBox ID="txtinserbarcode" runat="server" Width="110px"></asp:TextBox>
		</td>
	</tr>
	<tr>
		<td align="right" class="auto-style2">
		    ชื่อบาร์ดโคด้:
		</td>
		<td class="auto-style3">
		<asp:TextBox ID="txtinsertbarcodetext" runat="server" Width="110px"/>
		</td>
	</tr>
	<tr>
		<td align="right" class="auto-style2">
		    รหัสบาร์ดโค้ด:
		</td>
		<td class="auto-style3">
		<asp:TextBox ID="txtinsertproductcode" runat="server" Width="111px"/>
		</td>
	</tr>
	<tr>
		<td align="right" class="auto-style2">
		    หน่วยนับ:
		</td>
		<td class="auto-style3">
		    <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="csunit" DataTextField="CODE" DataValueField="CODE" Height="16px" Width="120px">
            </asp:DropDownList>
            <asp:SqlDataSource ID="csunit" runat="server" ConnectionString="<%$ ConnectionStrings:workConnectionString %>" SelectCommand="SELECT DISTINCT [CODE] FROM [CSUNIT]"></asp:SqlDataSource>
		</td>
	</tr>
	<tr>
		<td align="right" class="auto-style2">
		    สถานที่:
		</td>
		<td class="auto-style3">
		<asp:TextBox ID="txtinsertlocation" runat="server" Width="110px"/>
		</td>
	</tr>
	<tr>
		<td align=right class="auto-style2" >
		<center><asp:Button ID="Add"  runat="server" Text="Add" /></center>
		</td>
		<td class="auto-style3">
		<center><asp:Button ID="cancle" runat="server" Text="Cancel" /></center>
		</td>
	</tr>
</table>
</asp:Panel>

    </div>
    </form>
</body>
</html>





Tag : .NET, Ms SQL Server 2008, Web (ASP.NET), VB.NET, Windows







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2015-12-11 13:51:52 By : dendeenarat View : 1416 Reply : 1
 

 

No. 1



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

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

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

ไม่มีอะไรซับซ้อนครับ ตัว jQuery มันไม่ทำงานครับ

Code (JavaScript)
<script type="text/javascript">
    $(function () {
        $('[id*=GridView1]').footable();
    });
</script>


เอาไปไว้ล่างสุดครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-12-11 20:53:17 By : mr.win
 

   

ค้นหาข้อมูล


   
 

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