Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is there a way to avoid PostBack ?
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Is there a way to avoid PostBack ?
Versions des environnements
OS:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01309408
Message ID:
01309408
Vues:
50
Hi everybody,

It looks to me that every single click causes a postback. For instance, I have a GridView with a button
<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.

Is there any way to fix the problem?

Thanks a lot in advance.
If it's not broken, fix it until it is.


My Blog
Répondre
Fil
Voir

Click here to load this message in the networking platform