The concept is pretty basic, I simply want to re-use various ASCX user controls I've created within various ASPX Webforms that also happen to use MasterPages. I also want to handle error messages through a lable on the Webform. Another advantage of this is that you can organize your UI into a bunch of usercontrol files within a folder structure. It's not a groundbreaking design pattern, but works nicely for many small projects.
So, the end goal is to be able to pass a querystring to determine which control to load within the page. The URL would look like this: domain.com/Default.aspx?mod=grid
So, there are 4 items you need to create for my example: (in this order)
- /MasterPage.master (Master Page)
- /default.aspx (Webform)
- /default.aspx.cs (Webform codefile)
- /Modules (folder)
- /Modules/grid.ascx (UserControl)
Here's my default.aspx code:
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" CodeFile="Default.aspx.cs" Inherits="Default" %><asp:content id="Content1" runat="Server" contentplaceholderid="ContentPlaceHolder1"><asp:label id="ErrMsgLbl" runat="server"></asp:label></asp:content>
My Default.aspx.cs code:
public partial class Default : System.Web.UI.Page
{
string ModuleName = "";
protected void Page_Init(object sender, EventArgs e)
{
if (Request.QueryString["mod"] != null)
{
ModuleName = Request.QueryString["Mod"].ToString();
ContentPlaceHolder cph = this.Master.FindControl("ContentPlaceHolder1") as ContentPlaceHolder;
try
{
UserControl usercontrol = this.LoadControl("~/Modules/" + ModuleName + ".ascx") as UserControl;
cph.Controls.Add(usercontrol);
}
catch (Exception ex){ErrMsgLbl.Text = ex.Message;}
}
}
My Grid.ascx code:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Grid.ascx.cs" Inherits="Modules_Grid" EnableViewState="False" %>...your controls go here...
Cheers!
ramblings about technology, business, investing, and other things that may interest the average geek.
Thursday, March 26, 2009
Wednesday, March 25, 2009
Doom and gloom or American pride and hope??
I was pondering whether to get back into my Citigroup stock today and I started reading the google discussions on Citi here: http://finance.google.com/group/google.finance.662713/topics
There's a lot of idiots on there, but some people are saying the (C) is going back down to $1 and others are saying it's going to $5-10 in a few weeks. It's pretty crazy, but here's my take on this whole mess.
For starters, the glass is definitely half empty. I would love to agree with the optimists that says "we are America, we will pull out of this...". But the simple fact is that we are NO longer America, we are no longer the land of the free, the majority of Americans are a bunch of entitled lazy sacks of shit that are slaves to the enormous debt we have accumulated. We are heading in the same direction as France (referring to them being a former world power) and every other country will be on the sidelines watching us go down in flames and many of them laughing. The main reason is that most people would rather have "equal distribution of misery" then have "unequal distribution of blessings". It was only a matter of time until this country would come to this point, since they have been conditioned by politicians. Which, by the way, are the ones that will end up with ALL the power in the next decade. Government will be so big and powerful, it will be impossible to turn back. Look how this has happened to many other countries like Sweden, France, Italy and many others.
One thing to consider is... who's actually better off? Maybe ignorance is bliss, and it's time for everyone to get back to a more simpler way of life. There will always be very competitive people in the world, it's human nature. But if you think about it, success is simply relative to how your neighbor is doing. So, while you're eating your Dinty Moore soup out of a can in 10 years, I'll be eating Campbells Extra Chunky out of a bowl....cause that's how I roll... biotch!
There's a lot of idiots on there, but some people are saying the (C) is going back down to $1 and others are saying it's going to $5-10 in a few weeks. It's pretty crazy, but here's my take on this whole mess.
For starters, the glass is definitely half empty. I would love to agree with the optimists that says "we are America, we will pull out of this...". But the simple fact is that we are NO longer America, we are no longer the land of the free, the majority of Americans are a bunch of entitled lazy sacks of shit that are slaves to the enormous debt we have accumulated. We are heading in the same direction as France (referring to them being a former world power) and every other country will be on the sidelines watching us go down in flames and many of them laughing. The main reason is that most people would rather have "equal distribution of misery" then have "unequal distribution of blessings". It was only a matter of time until this country would come to this point, since they have been conditioned by politicians. Which, by the way, are the ones that will end up with ALL the power in the next decade. Government will be so big and powerful, it will be impossible to turn back. Look how this has happened to many other countries like Sweden, France, Italy and many others.
One thing to consider is... who's actually better off? Maybe ignorance is bliss, and it's time for everyone to get back to a more simpler way of life. There will always be very competitive people in the world, it's human nature. But if you think about it, success is simply relative to how your neighbor is doing. So, while you're eating your Dinty Moore soup out of a can in 10 years, I'll be eating Campbells Extra Chunky out of a bowl....cause that's how I roll... biotch!
Sunday, March 15, 2009
The only certainty is volatility. Get into short-term trading.
As you already know, the stock market in recent years has been a rollercoaster ride. If you started investing in blue chip stocks a few years ago, then you are probably among the millions who have been burned by the downturn that started in October of 2007 . The Dow went from an all-time high of 14,000+ to a 12-year low of 6,500 in less than 12 months. This was one of the greatest amount of wealth ever lost in U.S. history. In fact, over 25% of the U.S "millionaires club" were revoked of their membership cards and kicked to the curb.
So, what does this mean for the next 12 months? Well, as of today, the DOW is UP 9% for the past 5 days and actually DOWN 8% for the past month. But of course, people like Bernanke and the CEOs of Citigroup and Bank of America are telling us that this downturn may be on its way back up and that the banks are running at a profit again. I find it pretty hilarious that the market still responds positively to anything that these snake oil salesmen say. These are the same BS artists that have been lying about profits for years and got us into this mess.
My prediction is that the corruption on Wall St. is at an all-time high right now while bankers and the greediest of the greedy all scramble to save their own asses. This bear market rally, to me, reeks of an inside job and I am not convinced that 6500 will be the bottom.
Having said all that, I think there is still opportunity to make some profits this year. My strategy is stay as short term as possible with my trades and to buy into sectors when they get hit with bad news and then sell when they bounce off the bottom. One example trade I made was I bought Citigroup (3/6) @ $1.05 and sold it (3/10) @ $1.45 . Of course, I could have held it 2 more days and made another 20%, but I took my profit while I had the chance. Another example would be HealthSpring (HS), that fell to $5 after Obama announced medicare cutbacks and then Popped up to $6.50 3 trading days later.
So... if you wanna try your "luck" at this action there are a couple things you could do before risking your shirt. First, you can join http://www.updown.com/ and experiment with some trading techniques with zero risk and maybe even win some actual money. Then, once you have a handle on all the different types of trades\orders you can make go over to http://www.thinkorswim.com/ and give their trading application a try. Their desktop product is very professional and will take you from beginner trader to advanced. Also, they have a "paper money" account that lets you place virtual trades while you're getting the hang of their platform. I really like the advanced orders that you can place, like the many conditional orders. For example, I can have a BUY order automatically placed when a stock hits a certain Bid\Ask price and then after that order is filled, immediately place a SELL order placed at a specific price. You can even have a order placed if the DOW hits a certain level. All very handy when your trying to to do some profit taking and you don't have time to monitor all day long.
Lastly, don't forget to read about different trading strategies here: http://www.stta-consulting.com/TS/basic.htm
Good luck!
"The only constant is change, continuing change, inevitable change, that is the dominant factor in society today. No sensible decision can be made any longer without taking into account not only the world as it is, but the world as it will be." - Isaac Asimov
So, what does this mean for the next 12 months? Well, as of today, the DOW is UP 9% for the past 5 days and actually DOWN 8% for the past month. But of course, people like Bernanke and the CEOs of Citigroup and Bank of America are telling us that this downturn may be on its way back up and that the banks are running at a profit again. I find it pretty hilarious that the market still responds positively to anything that these snake oil salesmen say. These are the same BS artists that have been lying about profits for years and got us into this mess.
My prediction is that the corruption on Wall St. is at an all-time high right now while bankers and the greediest of the greedy all scramble to save their own asses. This bear market rally, to me, reeks of an inside job and I am not convinced that 6500 will be the bottom.
Having said all that, I think there is still opportunity to make some profits this year. My strategy is stay as short term as possible with my trades and to buy into sectors when they get hit with bad news and then sell when they bounce off the bottom. One example trade I made was I bought Citigroup (3/6) @ $1.05 and sold it (3/10) @ $1.45 . Of course, I could have held it 2 more days and made another 20%, but I took my profit while I had the chance. Another example would be HealthSpring (HS), that fell to $5 after Obama announced medicare cutbacks and then Popped up to $6.50 3 trading days later.
So... if you wanna try your "luck" at this action there are a couple things you could do before risking your shirt. First, you can join http://www.updown.com/ and experiment with some trading techniques with zero risk and maybe even win some actual money. Then, once you have a handle on all the different types of trades\orders you can make go over to http://www.thinkorswim.com/ and give their trading application a try. Their desktop product is very professional and will take you from beginner trader to advanced. Also, they have a "paper money" account that lets you place virtual trades while you're getting the hang of their platform. I really like the advanced orders that you can place, like the many conditional orders. For example, I can have a BUY order automatically placed when a stock hits a certain Bid\Ask price and then after that order is filled, immediately place a SELL order placed at a specific price. You can even have a order placed if the DOW hits a certain level. All very handy when your trying to to do some profit taking and you don't have time to monitor all day long.
Lastly, don't forget to read about different trading strategies here: http://www.stta-consulting.com/TS/basic.htm
Good luck!
"The only constant is change, continuing change, inevitable change, that is the dominant factor in society today. No sensible decision can be made any longer without taking into account not only the world as it is, but the world as it will be." - Isaac Asimov
Subscribe to:
Posts (Atom)