.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

overriding InitializeCulture

Posted By:      Posted Date: October 20, 2010    Points: 0   Category :ASP.Net


This is making me crazy, cant think of anything else. I have a page inherited from a ViewPage code given :

namespace testGlobal.Controllers
    public class test : ViewPage
        protected override void InitializeCulture()
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en");
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en");

View Complete Post

More Related Resource Links

Cutting Edge: Subclassing and Overriding ASP.NET Pages-Part I


There are a number of techniques that allow you to modify a running ASP.NET page without touching its source code. Dino discusses some this month.

Dino Esposito

MSDN Magazine April 2007

Problems with InitializeCulture()


Im trying to set upp localization with resource files for different languages. After reading tutorial i think i understand how it is done.

But when i try to use the InitilializeCulture i get an error!

Error 5 'FrontEndNavigator.InitializeCulture()': no suitable method found to override 21 E:\Dokuments\Programming Experiments\Finska Institutet\ShortFrontEndNavigator.master.cs 29 E:\...\Finska Institutet\

"FrontEndNavigator.InitializeCulture()': no suitable method found to override"

Here is part of my page:

public partial class FrontEndNavigator : System.Web.UI.MasterPage

    protected override void InitializeCulture()
           if (Session["Language"] == null || Session["Language"] == "sve")
            Session["Language"] = "sve";
            Thread.CurrentThread.CurrentCulture = new CultureInfo("sv-SE");

overriding "grand totals" for calculated members

hi all, is there a workaround for overriding "grand totals" for calculated members?  (I cannot use the workaround whereby I create the calculation in the DSV or view directly due to it being a pretty complex Descendant parent/child calculation).   thanks much for any thoughts, Cos

Overriding web.config in sharepoint webpart/using custom membership in web part

I'm developing a web part for MOSS 2007. The web part is being deployed to a web application which utilizes forms-based authentication, and role/membership providers to control users. The membership table has been edited to include addition user info (I am aware, that this isn't the best way to handle additional user, i.e. profiles etc., however, this is a requirement from another department). Since my web part needs to access this information, I was thinking of implementing a custom membership provider. So far I've followed: http://msdn.microsoft.com/en-us/library/6tc47t75.aspx and I've got my custom membership class, and a very stripped down membershipprovider-class. But how do I enable/use this membership provider in my web part? I've tried creating a simple web.config in the "WebPartCode" folder of my solution, next to my webpart code file, with connection string and membership provider tags. But I don't even really know how to build/reference/use the membership provider itself, so I don't know what else I need to do. I've built a C# class library project with the two classes (membershipprovider and custom membershipuser) and compiled it and installed it in the global assembly cache - is this correct? and how do I access them from here? Hope someone can help

Overriding runAllManagedModulesForAllRequests for single location

There is an ASP.NET application, having a virtual directory VIRDIR. Now if I code in web.config... <system.webServer>   <modules /></system.webServer> <location path="VIRDIR">   <system.webServer>      <modules runAllManagedModulesForAllRequests="true" />   </system.webServer></location> should this work the obvious way? With "runAllManagedModulesForAllRequests=false" for the entire web, except for the virtual directory, where "runAllManagedModulesForAllRequests=true". It seems as if "runAllManagedModulesForAllRequests" cannot be overridden for a specific location. Is this correct? Michael G. Schneider

Overriding a:link

I have an a:link defined in my style sheet, but I need a single link on the page to be a different color.  I'm not sure how to do this.  Just setting the color is not doing anything because its a link. Can someone help me with this please, I'm not a stylesheet expert.  Thanks in advance. This is the operable part of the stylesheet.  a:link, a:visited { color: #034af3; text-align: left; } a:hover { color: #1d60ff; text-decoration: none; } a:active { color: #034af3; } p { margin-bottom: 10px; line-height: 1.6em; } .Ck_PanelHeader_View { font-family:Verdana; Font-Size:12px; font-weight:bold; color:white; background-color:#990000; }  The text I'm trying to modify already has a style of CK_PanelHeader_view assigned to it.  <td class="Ck_PanelButton_View"> <asp:LinkButton ID="ModifyLnkP1" runat="server">Modify</asp:LinkButton> </td>  

Problem with overriding OnPaint method of System.Windows.Forms.Textbox

Hi,   I want to change the border colour of the Textbox. However, when I override the OnPaint method, some strange behaviour occurs.   The new border is drawn, as is the textbox background. However, the text itself appears in bold and only while I actually type something in, afterwards it disappears. I have provided a sample of my code here:         protected override void OnPaint(PaintEventArgs e)         {             base.OnPaint(e);             Rectangle rect = new Rectangle(0, 0, this.Width, this.Height);             ControlPaint.DrawBorder(e.Graphics, rect, _BorderColour, ButtonBorderStyle.Solid);         }   I have also set the style of the control to Userpaint, so that the paint method is actually used. Does anybody know how to solve this issue?

Gridview Template...not overriding CSS style?

I have a web application that has a CSS file for all the style in the web application.  I just added a gridview to the page, and I chose one of the predefined templates.  But the template specifications don't show up, instead my CSS styles do (for example, table background).  How can I override the CSS styles and show the actual template styles for the gridview?Thanks in advance. :)

Central Administration Policy is Overriding Portal Permissions


An Active directory user group has been added to Central Administration Policy with "full control" permissions to a Web Application.  This group should have Read Only" access.  When the group is removed or  "Policy" level changed in Central Administration, no member can access the Web App/portal.  

Is there any way to correct this.?

Overriding a .svc Request With Routing

I was drawn to an interesting question on StackOverflow recently about how to override a request for a non-existent .svc request using routing. One useful feature of routing in ASP.NET is that requests for files that exist on disk are ignored by routing. Thus requests for static files and for .aspx and .svc files don't run through the routing system. In this particular scenario, the developer wanted to replace an existing .svc service with a call to an ASP.NET MVC controller. So he deletes the .svc file and adds the following route: routes.MapRoute( "UpdateItemApi" , "Services/api.svc/UpdateItem" , new { controller = "LegacyApi" , action = "UpdateItem" } ); Since api.svc is not a physical file on disk...(read more)

MDX Script: overriding cells


hi all, I have a pesky MDX script issue whereas I want to override the [(All)] level for a dimension, to basically blank out the 'totals' -- and it works great, using the code below:

  ([Owner Curr].[Emp Curr].[(All)],

The problem that I have is that I'd like to do the same totals override on a similar dimension (same dimension structure but different data, a historical parent-child dimension) however, coding similarly (below) invalidates all cells when drilling into [Owner Hist].

  ([Owner Hist].[Emp Hist].[All],

My hypothesis is that, that is so, because the [Owner Curr] when not drilled into (drilling into [Owner Hist] only) assumes it's at the default [All] level and blanks out everything, hence also the [Owner Hist] cells. 

Am I overlooking something simple?

thanks a big bunch -- Cos.



Runtime Error after Overriding Object.Equals(Object)


Hello All,

Please consider my class TargetInfo:

class TargetInfo: IComparable<TargetInfo>, IEquatable<TargetInfo>, INotifyPropertyChanged
   // ...
   public string TargetId { ... }
   public string Name { ... }
   public string AlternateName { ...}

   public override bool Equals(object obj)
      return TargetId == ((TargetInfo)obj).TargetId;

MSDN states that if IEquatable<> is implemented, Object.Equals(Object) should be overriden (Object.GetHashTable() should be too). As seen above, I have done this.

At runtime, in my overriden Object.Equals(Object), I get an exception with this text: "Unable to cast object of type 'MS.Internal.NamedObject' to type 'TargetInfo'."

What is the problem with my implementation?



Problem in inserting another entity via overriding insert method


I have problem to inserting another entity in overriding method of first entity my code sample is like bellow :

partial void InsertEntity1 ( Entity1 instance )


     Entity2 x = new Entity2() ;

tihs.Entity2s.Add(x) ;





in inserting Entity2 I get Exception "The Operation Cannot be perform for the entity because it is not being change track"


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend