Wednesday, September 26, 2007

Into a Support Project

I’m in US and I’m into a Support Project. I was never told abt this project in offshore.
I am an ASP.NET developer and now I’m put in a support project which has nothing to do with .net.
I’m fighting hard with my managers but in vain, I may end up my next 6 months here L
Need to think what to make out of this opportunity (/threat)
I’ve to rethink what I really want in my life and have to have the action plan for that

Saturday, September 8, 2007

Get the previous page name:

if (Request.UrlReferrer != null)
{
string sPageName = Request.UrlReferrer.Segments[Request.UrlReferrer.Segments.Length - 1];
Response.Write("sPageName"+sPageName); }

Properties and OOPS

Properties are used to make the object look more real to client and there is no performance overhead since JIT and IL optimizes it

How to check whether the coding is really oops oriented?
Check whether all the methods created in the class can exist as static, if yes then the coding is not in oops methodology.

Manipulate DataTable in a GridView

The Best way to manipulate an entry in DataTable which is made editable using GridView which implements sorting and paging is by adding a primary key(dummy) to the DataTable

GridVIew make Column Invisible

u mostly make a column invisible in GridView so that u can use it internally in ur code for other purpose like this:

but when u access it in C# the Text of this cell will be empty.
The Text can be accessed only when the Cell is Visible

To get around this problem make the cell as Visible = false in Row_Created event in C#
Even this does not work I get index out of bound exception
The way out is the following code:
listtaskGridView.DataSource = ListTaskDS;
listtaskGridView.DataBind();
listtaskGridView.Columns[0].Visible = false;
listtaskGridView.Columns[7].Visible = false; listtaskGridView.Columns[8].Visible = false;

GridView accessing Columns Issue

GridView Columns seems to be hopeless when u do DataBound
When u bind the DataSource the only way to access GridView is thru its row only
Also I don’t like the way Cells are behaving in Row
I cannot give ColumnName in the cell
i.e., e.Row.Cells["AssignedAdm"] will not work
u even don’t have the facility to lookup the cell’s header like
e.Rows.Cells[0].Caption or e.Rows.Cells[0].HeaderText
The only way to get around the problem is remembering the cell index. The other way out is to get the GridView’s 1st row and get the Cell.Text which is the header and remember the index.

Dynamic Controls in GridView

It seems Button Event is not getting fired when is generated dynamically in Grid
The Below Link has the details:
http://community.strongcoders.com/blogs/ryan/archive/2005/12/01/gridview-dynamic-button-frustrations.aspx

I faced similar issue as well and have to content with a Button in the aspx page to get around this problem
After sometime I understand the issue is u add anything dynamically to GridView’s Footer (or any other rows) after DataBound then u deem to loose it.

A heavy solution is available in the following url need to fully understand the code.http://www.codeproject.com/useritems/GridView_with_insert_line.asp

Change in strategy

My office has blocked BlogSpot and hence I'm unable to update regularly.
I've taken some notes in my work which I'm going to paste here.
Many of these posts will be abstract and would not be complete.
But anyway if I don't do this then I would not be able to record anything.
So the Strategy is changed now:
Log all the things which u wish to log (even if they are incoherent)