I'm trying to use PostBackUrl
in LinkButton
within DataList
.
I tried the following, partially successfully.
<asp:LinkButton ID="linkBtnMarca" CommandArgument='<%# Eval("Marca") %>' **PostBackUrl='<%# string.Format("~/User/Produtos.aspx?Marca={0}", Eval("Marca")) %>'** runat="server" OnClick="linkBtnMarca_Click"><%# Eval("Marca") %></asp:LinkButton>
The link in the address bar actually changes depending on the tag when we click on LinkButton
, example User/Produtos.aspx?Marca=Bosch
, but suppose we do not want to click LinkButton
and we want to automatically go to User/Produtos.aspx?Marca=Bosch
link, how can I do that? Since without going to LinkButton
, it does not work.
Thank you.
EDIT:
Code Behind Brand
LinkButton lnksender = (LinkButton)sender;
Session["Marca"] = Convert.ToString(lnksender.CommandArgument);
lblInfo.Visible = true;
lblInfos.Visible = true;
lblInfoGet.Visible = false;
lblInfosGet.Visible = false;
lblInfoPesquisa.Visible = false;
lblInfo.Text = "A filtrar pela marca: ";
lblInfos.Text = Convert.ToString(Session["Marca"]);
MultiViewContent.DataBind();
ViewGridView.DataBind();
ViewListView.DataBind();
DataListCategorias.DataBind();
DataListMarcas.DataBind();