Asked by:
Development issues: Gridview dropping header...Design tab not working...VS 2013

Question
-
User-1190361682 posted
First issue: Gridview works most of the time, but when I set the user access to "Processor" instead of "Admin" or "Data Entry" the gridview drops the "Check All" button and moves the column headers over by 1. The data in the grid remains in tact, with the correct number of columns. This means the header for "Name" has shifted one left, now over the "Customer Number" column of data , and the "Customer Number" header is over the checkbox column, and the "Check All" checkbox header, normally in the first column, has dropped off the table.
As for the Design mode, In Visual Studio, C# ASP app design, when selecting a form, you can view code, but the design tab locks everything for a moment, then releases the mouse, but the form does not go to design mode. Instead, to once again work on the code, you need to close the form then open it in Code mode. This happens on all ASP projects. VB stand alone projects work fine.
Friday, July 8, 2016 7:32 PM
All replies
-
User36583972 posted
Hi senseiern,
From your description, I suggest you can share us more relevant code to help us reproduce the problem.
As for the Design mode, In Visual Studio, C# ASP app designI suggest you can use pictures to illustrate the problem.
Best Regards,
Yohann Lu
Monday, July 11, 2016 5:41 AM -
User-1190361682 posted
The data on the gridview is sensitive financial data, so I cannot share it online.
Also, because of the same issue, I cannot share the code for the issues.
Monday, July 11, 2016 4:50 PM -
User-1190361682 posted
Here is the image of the second issue:
As you can see, I select "Design" and the code remains instead of switching to the form.
Monday, July 11, 2016 4:55 PM -
User-1190361682 posted
Here is the code:
Monday, July 11, 2016 10:34 PM -
User36583972 posted
Hi senseiern,
Here is the image of the second issue:You can visit the Visual Studio and Visual Web Developer Express forum for getting better support.
http://forums.asp.net/1213.aspx/1?Visual+Studio+and+Visual+Web+Developer+Express
Gridview dropping headerYou can refer the following code.
HTML:
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script type="text/javascript"> $("[src*=OK1]").live("click", function () { $(this).closest("tr").after("<tr><td></td><td colspan = '999'>" + $(this).next().html() + "</td></tr>") $(this).attr("src", "images/NO1.PNG"); }); $("[src*=NO1]").live("click", function () { $(this).attr("src", "images/OK1.PNG"); $(this).closest("tr").next().remove(); }); </script> </head> <body> <form id="form1" runat="server"> <div> <asp:GridView ID="gvCustomers" runat="server" AutoGenerateColumns="false" CssClass="Grid" DataKeyNames="ID" OnRowDataBound="OnRowDataBound"> <Columns> <asp:TemplateField HeaderStyle-HorizontalAlign="Left" Visible="true" HeaderText="Check"> <HeaderStyle HorizontalAlign="Left" /> <ItemStyle HorizontalAlign="Left" /> <HeaderTemplate> <asp:CheckBox ID="chkAll" runat="server" AutoPostBack="true" Visible="true" /> </HeaderTemplate> <ItemTemplate> <asp:CheckBox ID="chk_Update" runat="server" /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField> <ItemTemplate> <img alt="" style="cursor: pointer" src="images/OK1.PNG" /> <asp:Panel ID="pnlOrders" runat="server" Style="display: none"> <asp:GridView ID="gvOrders" runat="server" AutoGenerateColumns="false" CssClass="ChildGrid"> <Columns> <asp:BoundField ItemStyle-Width="150px" DataField="ID" HeaderText="Order Id" /> <asp:BoundField ItemStyle-Width="150px" DataField="Filed1" HeaderText="Filed1" /> <asp:BoundField ItemStyle-Width="150px" DataField="Acctions" HeaderText="Acctions" /> </Columns> </asp:GridView> </asp:Panel> </ItemTemplate> </asp:TemplateField> <asp:BoundField ItemStyle-Width="150px" DataField="Product" HeaderText="Product Name" /> <asp:BoundField ItemStyle-Width="150px" DataField="Version" HeaderText="Version" /> </Columns> </asp:GridView> </div> </form> </body> </html>
ASPX.CS:
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { bind(); } } private void bind() { DataTable tblDatas = new DataTable("Datas"); DataColumn dc = null; dc = tblDatas.Columns.Add("ID", Type.GetType("System.Int32")); dc.AutoIncrement = true;// dc.AutoIncrementSeed = 1;// dc.AutoIncrementStep = 1;// dc.AllowDBNull = false; dc = tblDatas.Columns.Add("Product", Type.GetType("System.String")); dc = tblDatas.Columns.Add("Version", Type.GetType("System.String")); dc = tblDatas.Columns.Add("Description", Type.GetType("System.String")); DataRow newRow; for (int i = 0; i < 5; i++) { newRow = tblDatas.NewRow(); newRow["Product"] = "Count" + i.ToString(); newRow["Version"] = "2.0"; newRow["Description"] = "Hello boy"; tblDatas.Rows.Add(newRow); } gvCustomers.DataSource = tblDatas; gvCustomers.DataBind(); } protected void OnRowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string customerId = gvCustomers.DataKeys[e.Row.RowIndex].Value.ToString(); GridView gvOrders = e.Row.FindControl("gvOrders") as GridView; gvOrders.DataSource = gettable(); gvOrders.DataBind(); } } private DataTable gettable() { DataTable tblDatas = new DataTable("Datas2"); DataColumn dc = null; dc = tblDatas.Columns.Add("ID", Type.GetType("System.Int32")); dc.AutoIncrement = true;// dc.AutoIncrementSeed = 1;// dc.AutoIncrementStep = 1;// dc.AllowDBNull = false; dc = tblDatas.Columns.Add("Filed1", Type.GetType("System.String")); dc = tblDatas.Columns.Add("Test2", Type.GetType("System.String")); dc = tblDatas.Columns.Add("Acctions", Type.GetType("System.String")); DataRow newRow; for (int i = 0; i < 2; i++) { newRow = tblDatas.NewRow(); newRow["Filed1"] = "TTT S" + i.ToString(); newRow["Test2"] = "88.0"; newRow["Acctions"] = "3335854y"; tblDatas.Rows.Add(newRow); } return tblDatas; }
Best Regards,
Yohann Lu
Wednesday, July 13, 2016 9:43 AM