<asp:TemplateField> <ItemTemplate> <asp:LinkButton ID="lnkbtnRemoveRole" runat="server" Text="Remove User From Role" CommandName="RemUser" CausesValidation = "false" OnClick="lnkbtnRemoveRole_Click" /> </ItemTemplate> </asp:TemplateField>Every time I click on this button, the page goes through the Load procedure, where I have:
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack && this.Request.QueryString["m"] != null && this.Request.QueryString["m"] == "c") { this.MltvwUsers.ActiveViewIndex = 0; } if (this.MltvwUsers.ActiveViewIndex == 1 ) //&& !IsPostBack) { if (grdvwUsers.DataSource == null) { PopRoles(); PopGrid(); } //this.grdvwUsers.DataSource = RoleUsers; // grdvwUsers.DataBind(); } }I tried to remove re-creating Roles and Grids, but then the GridView stopped working. I can probably use the same approach as I used for another grid on this page where I bind it to the object. But I found this object later and that grid already existed on the page.