Moses on DotNetSlackers

.Net Gorean Lifestyler

This site

News

@ Cambridge, UK

Blogs

Sponsors

  • MaximumASP
  • Packet Sniffer
    Custom Essay
  • fax by email

Setting MasterPage ID Property

I face an issue that I want to set the ID of the MasterPage to use it in Request.Form. MasterPage is considered a UserControl as it inherits direclty from it. so when you add controls to your MasterPage and then create a content Page based on your MasterPage, your control ClientID will be prefixed with "ctl##$"
where ## is a number like "ctl00$cmbCulture".

So I created a constructor in the master page and add my ID to it like this:

public MasterPage()
{
this.ID = "MyMasterPage"
}

so now I know the generated ASP.NET ClientID will be "MyMaterPage$cmbCulture"

Ok now let me tell you my problem may be someone can give me a better solution. I want to build a multi-language application. I overrided the InitializeCulture Method in my Base Page. The overrided method uses Request.Form["cmbCulture"] to get the Culture from a drop down list. My cultures Drop down list is located on a master page, so I cannot access it the normal way mentioned above. so I have to work arround to use my own ASP.NET generated ClientID to use it as descriped above.

So, any better suggestions will be welcomed and appreaciated

Comments

No Comments

The leading UI suite for ASP.NET - Telerik radControls
Outstanding performance. Full ASP.NET AJAX support. Nearly codeless development.