0
votes

this is my offer.aspx inherits from masterpage ' />

my .cs file

protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { offerlistbind(); } }

public void offerlistbind()
{
    db1.strCommand = "  select Offer.OfferID, Offer.OfferName,Offer.Amount,Offer.FromDate,Offer.ToDate,Offer.Description,bm_package.PackageName,bm_country.Country from Offer inner join  bm_package on Offer.PackageID=bm_package.PackageID inner join bm_country on Offer.CountryID=bm_country.CountryID";
    offerlistnew.DataSource = db1.DataSet();
    offerlistnew.DataBind();

}

if i click the button instead of firing item command event item dataBound event is working protected void offerlistnew_ItemCommand1(object source, DataListCommandEventArgs e) { if (e.CommandName == "subscribe") { int ofid = Convert.ToInt32(e.CommandArgument); Response.Redirect("http://ecom.bom.tv/default.aspx?Offer=" + ofid + ""); } }

1

1 Answers

0
votes

Please use Hyperlink in place of button. If you use asp button then first it will do post back then it will redirect to another page. But using hyperlink you can directly redirect to another page. You can also increase the performance using this.

<asp:HyperLink ID="HyperLink1" runat="server" 
NavigateUrl='http://ecom.bom.tv/default.aspx?Offer=<%# Eval("OfferID") %>'
Text="Subscribe"></asp:HyperLink>

OR

<asp:HyperLink ID="HyperLink1" runat="server" 
NavigateUrl='<%# "http://ecom.bom.tv/default.aspx?Offer=" + Eval("OfferID") %>'
Text="Subscribe"></asp:HyperLink>

Let me know if any concern.