Friday, February 19, 2010
Using the ASP.Net GridView with ObjectDataSource and IQueryable objects
Posted by
Brad Oyler
at
3:23 PM
0
comments
Links to this post
Saturday, October 24, 2009
Uprising lyrics...a libertarian anthem??
Here are the lyrics to Muse - Uprising. Thoughts?
For one, I think they are totally relevant with what’s going on right now in the U.S.
Bottom line, no matter how you interpret these lyrics, a large amount of people in this country are fed up. Maybe MUSE is the modern day Thomas Paine…? Well, maybe not, but when foreigners start to point out massive problems going on in your back yard, you better listen up.
Paranoia is in bloom,
The PR transmissions will resume,
They’ll try to push drugs that keep us all dumbed down,
And hope that we will never see the truth around
(So come on)
Another promise, another scene,
Another packaged lie to keep us trapped in greed,
And all the green belts wrapped around our minds,
And endless red tape to keep the truth confined
(So come on)
They will not force us,
They will stop degrading us,
They will not control us,
We will be victorious
(So come on)
Interchanging mind control,
Come let the revolution take it’s toll,
If you could flick a switch and open your third eye,
You’d see that
We should never be afraid to die
(So come on)
Rise up and take the power back,
It’s time the fat cats had a heart attack,
You know that their time’s coming to an end,
We have to unify and watch our flag ascend
They will not force us,
They will stop degrading us,
They will not control us,
We will be victorious
Posted by
Brad Oyler
at
10:56 AM
0
comments
Links to this post
Wednesday, August 26, 2009
Social Media \ E-Marketing Platform...and it won't cost you a dime
The diagram below gives a high level concept of one way to integrate many of the free tools you need to start building your brand and\or launching a e-marketing campaign.
It's pretty simple, you just need a blackberry\iphone and a PC\Mac to get things going.
The hard part is being able to create content within your blog that people will actually be interested in reading. But if you have a passion, then I'm sure you will have readers. "If you build, they will come" - Shoeless Joe in Field of Dreams
The 2 key tools you will use are;
1. Your blog - which you will use to create articles about your interests. Your blog can then be syndicated to your website(s), myspace, and facebook via RSS.
2. Your Twitter account - which will help you build a network of followers and also keep in touch with your fans\followers. Your tweets (status updates) can then be syndicated to myspace\facebook via myspace\facebook apps and of course many of social networks in the near future.
Posted by
Brad Oyler
at
9:40 AM
0
comments
Links to this post
Wednesday, August 5, 2009
Cash for clunkers?? Are you kidding?
Ok, by now , most of you know about the "Cash for clunkers" federal program.
The intention of the genius U.S. Congress and noble leaders is to take fuel inefficient cars off the road and give car owners a $4500 rebate in order to buy a new and more fuel efficient car.
This sounds very altruistic, but did anyone actually think about what we are actually persuading people to do? So, it's now a good idea to destroy a debt-free asset(clunker), in exchange for a car-loan(debt) that someone did not need in the first place?? Seriously? How can this really be a good thing? I don't get it.
I am willing to bet that this will come back to haunt us in the next 2-3 years when millions of people can't afford to pay for there car that they didn't need.
Does anyone remember when the govt decided (CRA) that they should make getting a mortgage easier for lower income home buyers? That seemed to have worked out superbly. Why is it possible for everyone else to learn from their mistakes, but Congress's only solution is too keep repeating their mistakes. Aarrrgh! Thank God for alcohol.
Posted by
Brad Oyler
at
11:33 PM
0
comments
Links to this post
Thursday, July 16, 2009
Wednesday, May 20, 2009
Triple leveraged, inverse ETF for Financials: $FAZ
Ok, if you're not familiar, there's a stock\ETF, called Direxion Daily Finan. Bear 3X ($FAZ) that inversely tracks the Russell 1000 Financial Index (RIFIN.X) with triple leverage.
Posted by
Brad Oyler
at
10:48 AM
0
comments
Links to this post
Thursday, May 7, 2009
C# How To: Cascading dropdowns on a Formview for Country\Region selection
This is something most ASP.Net apps deal with regularly, but I couldn't find one solid solution on the interwebs. I needed a user to select a country and then have the "Region" dropdown be populated with the expected list of regions (states, provinces, etc)
I hope this helps. If not, at least I'll remember how it's done.
FYI, I've intentionally left out some details around data access since I am using ObjectDataSources and you can handle data access however u need. I also assume that you have a simple FormView control working that can update a record in your database.
Steps:
1: Make sure 'EnableViewState=true' is on your ASPX page or Masterpage.
2: Make sure you have a field like Country and Region in the DataTable you are editing and make sure you can update these values through an objectdatasource, if you want this example to work.
3: Create an objectdatasource (ie. odsCountries) that returns a list of Countries and bind to ddlCountry.
<asp:ObjectDataSource ID="odsCountries" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetCountries" TypeName="BLL">
</asp:ObjectDataSource>
4: Create an objectdatasource (ie. odsRegions) that returns a list of Regions with a Country parameter and bind to ddlCountry.
<asp:ObjectDataSource ID="odsRegions" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetRegions" TypeName="BLL">
<SelectParameters>
<asp:ControlParameter ControlID="editForm$ddlCountry" Name="Country"/>
</SelectParameters>
</asp:ObjectDataSource>
5: Add a Country dropdownlist to the Formview's edit template (ie. ddlCountry)
<asp:DropDownList ID="ddlCountry" runat="server" SelectedValue='<%# Bind("COUNTRY") %>' DataSourceID="odsCountries"
OnDataBound="ddlCountry_DataBound" DataTextField="Country" DataValueField="Country" AutoPostBack="True"></asp:DropDownList>
6: Add a Region dropdownlist to the Formview's edit template (ie. ddlRegion)
<asp:DropDownList ID="ddlRegion" DataSourceID="odsRegions" runat="server" AutoPostBack="True"
DataTextField="REGION" OnDataBound="ddlState_DataBound"/>
7: Create 2 DataBound EventHandlers for each DropDownlist
protected void ddlCountry_DataBound(object sender, EventArgs e)
{
DropDownList ddlCountry = (DropDownList)sender;
ListItem li = new ListItem("Choose a Country", "");
ddlCountry.Items.Insert(0, li);
FormView editForm = (FormView)ddlCountry.NamingContainer;
if (editForm.DataItem != null)
{
string strCountry = ((DataRowView)editForm.DataItem)["COUNTRY"].ToString();
ddlCountry.ClearSelection();
ListItem li2 = ddlCountry.Items.FindByValue(strCountry);
if (li2 != null) li2.Selected = true;
}
}
protected void ddlRegion_DataBound(object sender, EventArgs e)
{
DropDownList ddlRegion = (DropDownList)sender;
ListItem li = new ListItem("Choose a Region", "");
ddlRegion.Items.Insert(0, li);
FormView editForm = (FormView)ddlRegion.NamingContainer;
if (editForm.DataItem != null)
{
string strRegion = ((DataRowView)editForm.DataItem)["REGION"].ToString();
ddlRegion.ClearSelection();
ListItem li2 = ddlRegion.Items.FindByValue(strRegion);
if (li2 != null) li2.Selected = true;
}
}
8: Don't forget to add this to your Update\Insert parameters on the Objectdatasource for your formview. This is needed to properly find the Region ddl within the Formview
<asp:ControlParameter ControlID="editForm$ddlRegion" Name="Region" />
Posted by
Brad Oyler
at
9:14 AM
2
comments
Links to this post
Thursday, March 26, 2009
C# How To: Create a simple "module" framework using ASCX UserControls
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!
Posted by
Brad Oyler
at
10:26 AM
0
comments
Links to this post
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!
Posted by
Brad Oyler
at
3:13 PM
0
comments
Links to this post
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
Posted by
Brad Oyler
at
11:59 PM
0
comments
Links to this post

