2
I’m trying to use the PostBackUrl
in a LinkButton
within the DataList
.
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 let’s imagine that we don’t want to click on LinkButton
and we want to automatically go to the link User/Produtos.aspx?Marca=Bosch
, how can I do that? Since I don’t go to LinkButton
, doesn’t work.
Thank you.
EDIT:
Code Behind Marca
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();
How’s the Code Behind that reads the parameter
Marca
?– Leonel Sanches da Silva
See the edited response.
– Chirag Geiantilal