Hi all,
I'm trying to make it so that the title of my page updates when the selected choice from either the BrowseProducts or BrowseArticles page changes, and I'm having a lot of trouble figuring this out. The ddlDepartments_SelectedIndexChanged only binds data with gvw.Products.DataBind(); however I'm trying to edit the code for BrowseProducts.aspx.cs to update the title in the following way:
Code:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MB.TestingMachines;
using MB.TestingMachines.BLL.Store;
namespace MB.TestingMachines.UI
{
public partial class BrowseProducts : BasePage
{
int _departmentID = 0;
protected void Page_Load(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.Request.QueryString["DepID"]))
_departmentID = int.Parse(this.Request.QueryString["DepID"]);
if (!this.IsPostBack)
{
// try to load the product with the specified ID, and raise an exception if it doesn't exist
Department department = Department.GetDepartmentByID(_departmentID);
if (department == null)
this.Title = String.Format(this.Title, ("All Products"));
else
this.Title = String.Format(this.Title, (department.Title));
}
<!-- THIS IS WHERE I'D ASSUME SOME CODE WOULD GO? -->
}
}
}
And the code for the ASPX page is:
Code:
<%@ Page Language="C#" MasterPageFile="~/page.master" EnableEventValidation="false" AutoEventWireup="true" CodeFile="BrowseProducts.aspx.cs" Inherits="MB.TestingMachines.UI.BrowseProducts" Title="Lako Tool | {0}" %>
<%@ MasterType VirtualPath="~/page.master" %>
<%@ Register Src="./Controls/ProductListing.ascx" TagName="ProductListing" TagPrefix="mb" %>
<asp:Content ID="Content" ContentPlaceHolderID="pagecol1" Runat="Server">
<p class="header">Product Catalog</p>
<div class="colText">
<mb:ProductListing id="ProductListing1" runat="server" />
</div>
</asp:Content>
I've tried a few things so far, but nothing has worked. Any tips?