Christopher's profileBlue FenixPhotosBlogListsMore ![]() | Help |
|
Blue FenixSomething witty goes here. May 25 Sql Server Management Studio Express - you suck.I would like to know who thought it was a good idea to remove "import data..." and "export data..." from this particular flavor of the worst front end to an otherwise badass rdbms. I shouldn't have to fight with a program to get my databases in order. What a joke. [ Nothing Playing. ]April 25 Exposing Hidden EventsI recently ran into a neat little nugget of functionality in C# with events. Normally in C# when we define events we stop at something like this: public event EventHandler<MyEventArgs> MyEvent; The thing is, you can explicitly implement the add and remove accessors if you throw some curly braces into the mix. Why does this matter? Imagine that you have a MainForm, and a usercontrol named ControlPanel. ControlPanel contains another usercontrol called hiddenControl that exposes an event that you want to handle in MainForm, but all MainForm has access to is ControlPanel... public event EventHandler<MyEventArgs> MyEvent{ add{ this.hiddenControl.MyEvent += value; } remove{ this.hiddenControl.MyEvent -= value; } } Now you can subscribe to the event in MainForm without making the usercontrol member public in ControlPanel. [ Currently Playing : Burn Away - Foo Fighters - One by One (4:57) ] March 22 Windows Updates Make Me Nervous
Source: Windows Updates Make Me Nervous March 15 ASP.NET - UrlRewriting with PathInfo and base urlsI read this excellent post from ScottGu and decided to use it with a page that implemented a masterpage. I didn't have to use postbacks in my scenario, but there were links included from the masterpage. The problem is that if you use app-relative paths for your href attributes (ex: <a href="/default.aspx">) the browser (FF 2.0.0.2 and IE 7 anyways) interperets the url with pathinfo differently than a url without. The base url includes the original page (ex: http://localhost:3333/rewriter.aspx/default.aspx). Guess what? The webserver picks up the last .aspx extension, default.aspx, that bad boy doesn't exist, and you get a 404 instead of going to http://localhost:3333/default.aspx. In the comments, Ian Oxley suggested that you can re-base links in your page/css/other static files using the <base> element in the head of your page. I expanded on it a little, since this behavior is only on one page of my site currently, and added the following code into the Page_Load event of the offending page: this.Header.Controls.Add(new LiteralControl("<base href=\"" + Request.Url.ToString().Replace(Request.RawUrl, "").Replace(Request.PathInfo, "") + "\">")); Now the base tag works on both the live site and the one that WebDev.WebServer spins up as well. [ Currently Playing : Them Bones - Alice in Chains - Nothing Safe: Best of the Box (2:29) ] March 08 SubSonic Scaffold control - a GridView with ClassSo I've been able to dig my teeth into some asp.net hacking recently, and I've been In dealing with the scaffold control I ran into a funny issue: none of the exposed properties on the scaffold control will output any style info of the GridView that the control uses (that I could figure out anyways). I ended up with black text on a black background. :/ Seeing as I have the source, I decided to give the scaffold control's GridView a little class...hello GridViewCssClass property! I set it up just like the EditTable*CssClass properties, just a string property, with similar attributes to the other properties hanging around there: [Bindable(true)] [Category("Display")] [Description("Sets the CSS class used by the gridview.")] [DefaultValue(ScaffoldCSS.WRAPPER)] //CDF: just to have something to start with. public string GridViewCssClass { get { return _gridViewCssClass; } set { _gridViewCssClass = value; } } Then, in the CreateGrid method make it actually do something: private void CreateGrid() { Label lblTitle = new Label(); surroundingPanel.Controls.Add(lblTitle); lblTitle.Text = "<h2>" + schema.Name + " Admin</h2>"; grid.ID = "grid"; grid.CssClass = this.GridViewCssClass; surroundingPanel.Controls.Add(grid); if (!Page.IsPostBack) { BindGrid(String.Empty); } //add a column to the grid for editing } And now I can declaratively set the CssClass that the GridView uses to, oh, say, .whitetext :) August 16 Windows Live Writer
August 11 RE: Finding calling method using reflectionExactly what I was looking for...I don't know a lot about reflection, so I wonder if there is a more elegant way to get this info. July 20 Whip it Real Hard
As an extra added bonus, Rick Ross opened up for Ghostface. He only did like 5 tracks, but was spot on for Hustlin'. He's obviously very comfortable with the song by now and it shows in his performance. Looked like he was really having fun with it which always helps for a good show.
[ Currently Playing : Smiley faces - Gnarls Barkley - (3:05) ] |
||||||
|
|