我的gridview有一个下拉过滤器,我应用了足够的javascript,使其在移动设备中具有响应性。但问题是,当我使用下拉列表过滤时,它的响应能力以及css都会丢失。这是代码请支持。
<asp:GridView ID="GridView1" CssClass="footable" runat="server" AutoGenerateColumns="false"
Style="max-width: 500px">
<Columns>
<asp:BoundField DataField="Name" HeaderText="Customer Name" />
<asp:BoundField DataField="Id" HeaderText="Customer Id" />
<asp:BoundField DataField="Country" HeaderText="Country" />
<asp:BoundField DataField="Salary" HeaderText="Salary" />
</Columns>
</asp:GridView>
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[4] { new DataColumn("Id"), new DataColumn("Name"), new DataColumn("Country"), new DataColumn("Salary") });
dt.Rows.Add(1, "John Hammond", "United States", 70000);
dt.Rows.Add(2, "Mudassar Khan", "India", 40000);
dt.Rows.Add(3, "Suzanne Mathews", "France", 30000);
dt.Rows.Add(4, "Robert Schidner", "Russia", 50000);
GridView1.DataSource = dt;
GridView1.DataBind();
//Attribute to show the Plus Minus Button.
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";
//Adds THEAD and TBODY to GridView.
GridView1.HeaderRow.TableSection = TableRowSection.TableHeader;
}
}