Monday, December 22, 2008

Set Script src from root folder (dynamic)

if u are working with master pages and u are using javascript menus on master to navigate child pages in content place holder.
for that u need to save java script code in a particular folder and give path of that file in master page but as we know that path gets change when ever we go up and down in hierarchical of pages then that menu got disappear because of static path of .js file so we need to give dynamic path for java script file..and to do so we need to write following code to get dynamic path which can work in hierarchical up and down.

below code in design view of master page
< script type="text/javascript" src=" < %# Page.ResolveClientUrl("~/images/right_menu/data.files/rolen.js")% > " > < /script >

and following code in page load of master page
Page.Header.DataBind();
Read More

Friday, December 19, 2008

Horizontal Menu and Sub Menu

To generate Horizontal Menu and sub menu

< style type="text/css">
#topNav
{
width: 100%;
background-color: #964240;
vertical-align: bottom;
padding: 0;
margin: 0;
z-index: 0;
}
#subNav
{
width: 100%;
border-left: solid 1px #000;
border-bottom: solid 1px #000;
border-right: solid 1px #000;
padding: 0;
margin: 0;
height: 24px;
background-color: #eee;
}
.staticMenuItemStyle
{
width: 89px;
background-color: #7A1312;
border: solid 1px #000;
color: #fff;
text-align: center;
}
.staticSelectedStyle
{
background-color: #eee;
color: #000;
border-bottom: solid 1px #eee;
z-index: 100;
}
.staticHoverStyle
{
background-color: #902423;
}

.substaticMenuItemStyle
{
width: 89px;
background-color: #eee;
text-align: center;
}
.substaticHoverStyle
{
background-color: #D0D0D0;
border: solid 1px #A68F8F;
}
< /style>


< !-- code for design of menus creation, place it in master page or simple page eg:- RolenMaster.master-- >


< div >
< asp:Menu ID="Menu1" OnPreRender="setRef" runat="server" DataSourceID="SiteMapDataSource1" MaximumDynamicDisplayLevels="0" Orientation="Horizontal" >
< StaticMenuItemStyle CssClass="staticMenuItemStyle" / >
< StaticSelectedStyle CssClass="staticSelectedStyle" / >
< StaticHoverStyle CssClass="staticHoverStyle" / >

< /asp:Menu >
< asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" / >
< asp:Menu ID="Menu2" runat="server" DataSourceID="SiteMapDataSource2" MaximumDynamicDisplayLevels="0" Orientation = "Horizontal" >
< StaticMenuItemStyle CssClass="substaticMenuItemStyle" / >
< StaticHoverStyle CssClass="substaticHoverStyle" / >
< /asp:Menu >
< asp:SiteMapDataSource ID="SiteMapDataSource2" runat="server" ShowStartingNode="false" StartingNodeOffset="1" / >



< asp:ContentPlaceHolder OnPreRender="getRef" ID="ContentPlaceHolder2" runat="server" >
< /asp:ContentPlaceHolder >

< /div >


< !-- code in RolenMaster.Master.cs, code file of above page -->

protected void setRef(object sender, EventArgs e)
{
if (Menu1.SelectedItem != null) Session["lastTopMenuItemDataPath"] = Menu1.SelectedItem.DataPath;
}

protected void getRef(object sender, EventArgs e)
{
string ldp = Session["lastTopMenuItemDataPath"] == null ? "" : Session["lastTopMenuItemDataPath"].ToString();
if (ldp != null) foreach (MenuItem m in Menu1.Items) m.Selected = (m.DataPath == ldp && Menu2.Items.Count != 0);
}


< !-- site map -- >

< ?xml version="1.0" encoding="utf-8" ? >
< siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
< siteMapNode url="WebForm1.aspx" title="root" >
< siteMapNode url="WebForm1.aspx?ctrlID=1000" title="Admin" >
< siteMapNode url="WebForm1.aspx?ctrlID=1001" title="Create Project" > < /siteMapNode >
< siteMapNode url="WebForm1.aspx?ctrlID=1002" title="Create Workflow" > < /siteMapNode >
< siteMapNode url="WebForm1.aspx?ctrlID=1003" title="test" > < /siteMapNode >
< siteMapNode url="WebForm1.aspx?ctrlID=1004" title="not found" > < /siteMapNode >
< /siteMapNode >
< siteMapNode url="WebForm1.aspx?ctrlID=1100" title="Browse" >
< siteMapNode url="WebForm1.aspx?ctrlID=1101" title="Browse Projects" > < /siteMapNode >
< siteMapNode url="WebForm1.aspx?ctrlID=1102" title="Browse Workflows" > < /siteMapNode >
< siteMapNode url="WebForm1.aspx?ctrlID=1103" title="Welcome page" > < /siteMapNode >
< siteMapNode url="WebForm1.aspx?ctrlID=1104" title="Two.Four" > < /siteMapNode >
< /siteMapNode >
< /siteMapNode >

< /siteMap >
Read More

Thursday, December 18, 2008

Stop Refresh in Master / Child Page.

instead of using Master page use frame set to avoid refresh when click from menu to open a page
Steps:
1. add a webpage in ur application
2. add following code in design
< head runat="server">
< title>Untitled Page< /title>
< /head>

< frameset framespacing ="0" rows="100,*,50" noresize="yes">
< frame name="menu" src="headerpage.aspx" noresize scrolling="no" />
< frame name="content" src="" scrolling="auto" />
< frame name="footer" src="footerpage.aspx" noresize scrolling="auto" />
< noframes>
< body>
< p> your browser not support framesets< /p>
< /body>
< /noframes>
< /frameset>



3. add a webpage in ur application which will contain data of header
add following code in it (menu of header) to open pages in content area of page u added in step1
protected void Button1_Click(object sender, EventArgs e)
{
string url = "studentdetails.aspx";
string framescript = "";
Page.ClientScript.RegisterStartupScript(this.GetType(),"FrameScript",framescript);

}

4. add a webpage in ur application which will contain data of footer
Read More

Thursday, December 11, 2008

.NET Architect


Two types of architects are their

1. The software architect (solution architect)
2. The enterprise architect (binding business needs into the overall system/software architecture.



A good architect in my opinion should have the following characteristics regardless of technology:

1. The ability to take a complex problem and break it down into simple well defined manageable subcomponents that are loosely coupled. This reduces tight dependences, whereby, the architect can farm out subcomponents. Thus, allowing for true parallel development across a large team.

2. Architect and design a solid base application framework that allows for extensibility and ease of maintainability. In essence, design a system that can withstand the test of time, as well as meet other tenets of industrial-strength software.

3. Ensure that the application scales, and meet or exceed SLA commitments (i.e. security, performance, durability, robustness, etc)

4. Use best practices and architectural design patterns within reasons: DON’T over-engineering the system to death.

5. Do more with less: Use proven technologies and reusable library frameworks

6. Ensure that the system is highly automated, requiring little to no operator intervention, thus, reducing the Total Cost of Ownership (TCO)

7. Has a lot of real experience in truly distributed architectures. Someone who can talk-the-talk and walk-the-walk.

8. Enterprise architects should be very much able to defend, promote and sell the business case for the architecture to be of true value for the customer/company implementing their architecture. Unfortunately this comes with political skills as well, and these are normally obtained through years of experience in the field.

9. Enterprise Architect is much different than a Solutions Architect. Enterprise Architect is an individual that can walk into a business and model the business processes, lead the development of a strategic plan, etc. i.e. if you are familiar with the zachman framework (as an example, I know others exist) and have experience in that arena, you'll understand what an EA is. A solutions Architect can take a describe box or boxes and put together a solution. They can also provide guidance on standards, technology choices, etc. Finally, they help lead the development efforts with the technical team and provide a liason between the business and technical side. The sometimes work at a level similiar to a PM on a project, but not always.

10. A Solutions Architect is not just someone who understands technology. An SA understand people, understands the business, understands the technology, and has the experience necessary to meet the requirements on time, on budget, with customer satisfaction.

11. He should be familiar with all the latest fashion in software production with a rock solid discernment to shift out the gold from the fluff. In other words, able to choose the right path into the future.

12. Strive for KISS in all situation. He always keep "well-meaning impractical theorists" out of the project.

13. He is a good programmer (takes one to know one) but do not compete with his staff in the project.

14. He has experience before of the businessdomain of the project.

15. An architect mitigates the technical risks associated with a system. A technical risk is something that is unknown, unproven, or untested. Risks are usually associated with the service-level requirements and can occasionally be associated with a business requirement. Regardless of the type of risk, it is easier to address the risks early in the project while creating an architecture, then to wait until construction when you have a large developer base that could potentially be waiting while risks are solved.

16. An architect must lead the development team to ensure the designers and developers build the system according to the architecture. As the leader, difficult decisions must be made about trade-offs in the system and the architect is the person who must make those decisions. To lead, the architect must be a good written and oral communicator. It is up to the architect to communicate the system to the designers and developers who will build it. This is typically done with visual models and group discussions. If the architect cannot communicate effectively, then the designers and developers will probably not build the system correctly.

17. An architect should be able to produce and effect a business solution using whatever tools are reasonably and readily made available.

18. A true architect is resourceful enough to look at the problem, find and gain a knowledge of the basic resources (technologies and people) necessary to construct a solution that meets the immediate business need.

Microsoft Certified Architect Programs

The Microsoft Certified Architect (MCA) programs identify and certify top industry experts in IT architecture. Microsoft Certified Architects have proven experience designing and delivering the right IT solutions for enterprise customers. These MCA professionals typically have five or more years of advanced IT architecture experience, possess expert technical and leadership skills, and become part of an exclusive, world-class community of experts who continually collaborate on best practices within the IT industry. MCA candidates must definitively showcase seven competencies of business acumen and technological proficiency to a panel of industry experts in a Review Board interview in order to achieve the MCA credential. MCA certification was built by and for industry architects.
Read More

Tuesday, December 9, 2008

How to provide background image in TD from root path

use this code to provid background image url for TD which map to root path

< td align="left" background=' < %= Server.MapPath("~/images/rolen.gif") %>' >

u can also use this code also

< td align="left" background=' < %= ResolveClientUrl("~/images/box.gif") %>' >


well i prefer second "ResolveClientUrl" becoz ther Server.MapPath map path at server like c:\rajesh\rolen\mukesh.jpg
Read More

Set Master Page at Runtime

to set master page for any page at run time. u need to write following code


protected void Page_PreInit(object sender, EventArgs e)
{
this.MasterPageFile = "~/Business_Partner/businesspartner.Master";
}

but page should contain contentplaceholder of same name as it is in master which u are assigning it.
Read More

Thursday, December 4, 2008

Disable all validations for specific control

asp:Button ID="OkButton" runat="server" CausesValidation="false" Text="OK" OnClick="onOk"

set property named : CausesValidation to false if u want to disable validation for particular control


CausesValidation="false"
Read More
Powered By Blogger · Designed By Seo Blogger Templates