Pages

About Me

My photo
ForEach(Minute in MyLife) MyExperience ++;

Tuesday, May 31, 2011

1. What’s the difference between Response.Write() andResponse.Output.Write()?
Response.Output.Write() allows you to write formatted output.

2. What methods are fired during the page load?
Init() - when the page is instantiated
Load() - when the page is loaded into server memory
PreRender() - the brief moment before the page is displayed to the user as HTML
Unload() - when page finishes loading.

3. When during the page processing cycle is ViewState available?
After the Init() and before the Page_Load(), or OnLoad() for a control.

4. What namespace does the Web page belong in the .NET Framework class hierarchy?
System.Web.UI.Page

5. Where do you store the information about the user’s locale?
CodeBehind is relevant to Visual Studio.NET only.

6. What’s the difference between Codebehind="MyCode.aspx.cs" andSrc="MyCode.aspx.cs"?
CodeBehind is relevant to Visual Studio.NET only.

7. What is the Global.asax used for?
The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.

8. What are the Application_Start and Session_Start subroutines used for?
This is where you can set the specific variables for the Application and Session objects.

9. Whats an assembly?
Assemblies are the building blocks of the .NET framework;

10. Whats MSIL, and why should my developers need an appreciation of it if at all?

MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL. MSIL also allows the .NET Framework to JIT compile the assembly on the installed computer.

11. Which method do you invoke on the DataAdapter control to load your generated dataset with data?
The Fill() method.

12. Can you edit data in the Repeater control?
No, it just reads the information from its data source.

13. Which template must you provide, in order to display data in a Repeater control?

ItemTemplate.
14. Name two properties common in every validation control?

ControlToValidate property and Text property.

15. What base class do all Web Forms inherit from?

The Page class.
16. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?

Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the user's browser to another page or site. This performas a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address

17. What is ViewState?

ViewState allows the state of objects (serializable) to be stored in a hidden field on the page. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source. ViewState is used the retain the state of server-side objects between postabacks.

18. What is the lifespan for items stored in ViewState?

Item stored in ViewState exist for the life of the current page. This includes postbacks (to the same page).

19. What does the "EnableViewState" property do? Why would I want it on or off?
It allows the page to save the users input on a form across postbacks. It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser. When the page is posted back to the server the server control is recreated with the state stored in viewstate.

20. What are the different types of Session state management options available with ASP.NET?

ASP.NET provides In-Process and Out-of-Process state management. In-Process stores the session in memory on the web server. This requires the a "sticky-server" (or no load-balancing) so that the user is always reconnected to the same web server. Out-of-Process Session state management stores data in an external data source. The external data source may be either a SQL Server or a State Server service. Out-of-Process state management requires that all objects stored in session are serializable.

Clear All Controls Inside a form

foreach (Control ctrl in this.frm1.Controls)
{
if (ctrl is TextBox)
(ctrl as TextBox).Text="";
}
Or move all TextBoxes into Panel, Panel.Controls.Clear(); will work..

Find Control Inside Gridview

if (e.Row.RowType == DataControlRowType.DataRow)
{
Label Lbl1 = (Label)e.Row.FindControl("Lbl_STATUS");
if (Lbl1.Text == "True")
Lbl1.Text = "Active";
else if (Lbl1.Text == "False")
Lbl1.Text = "Inactive";
}

Thursday, May 19, 2011

“Community of communities” grows up

d Java.net, called as ‘ Community of communities’ is a big umbrella of communities that Can be divided – by bloggers, developers, end users and educators. Have two major components – a forge side and a social side. The forge, accessible via Project t Tab, or by going directly to a project. The social side of Java.net offers a more social presence.
Java.net has been undergoing major changes –switching forge infrastructure and building a stronger CMS to support social and editorial side.Java.net was originally launched by Sun,2003 but as the site grew, more users and traffic made taking the site offline for a few days or weeks to do upgrades.
Now, more refinements in the process and Java.net embrace the raw definition of a “community “– a group of people with a common interest or goal. Java.net can now support new ideas and communities as they arrive, instead of building them out and assuming that people show up, also have more powerful tools for analysis to help showcase the community’s real leader and reward them with privileges and access to tools that will make what they are doing easier...

Blog: java.net/blogfront

Tuesday, May 17, 2011

Loading Year Dynamically inside Drop down List

for (int year = 1990; year <= DateTime.Now.Year; year++)
Ddl_USER_PASSYEAR.Items.Add(new ListItem(year.ToString(), year.ToString()));

Wednesday, May 11, 2011

Validation expressions for Image Format

ValidationExpression="^.*\.((j|J)(p|P)(g|G)|(j|J)(p|P)(e|E)(g|G)|(p|P)(n|N)(g|G)|(g|G)(i|I)|(f|F))$"

Regular validation expression for Mobile Number

Validation expression ="^[0-9]{10}"

Binding Values from db dynamically to dropdown list

dropdownlist binding

drp_Brand.DataSource = ds.Tables[0];
drp_Brand.DataTextField = "Brand";
drp_Brand.DataValueField = "Brand";
drp_Brand.DataBind();

Append a default item to listbox / Dropdown List

1.Append a default item to listbox/dropdown
Lb_Prospect_List.Items.Insert(0, new ListItem("Select"));

Trim Text Inside Gridview

<%#Eval("TASK_DESC").ToString().Substring(0,Math.Min(20,Eval("TASK_DESC").ToString().Length))+"...." %>

We cant trim details from SQL server if it was saved as datatype " Text " , so access as it is and trim inside the grid view

Tuesday, May 10, 2011

Wednesday, May 4, 2011

format datetime

http://www.geekzilla.co.uk/View00FF7904-B510-468C-A2C8-F859AA20581F.htm

Trim Values Inside Gridview

<%# Eval("EMP_NAME").ToString().Substring(0,Math.Min(3,Eval("EMP_NAME").ToString().Length))+"..." %>

........this will trim ur values into 3 characters + ...

SQL query to toggle between 0 and 1

UPDATE products SET
in_stock = CASE WHEN in_stock = 1 THEN 0 ELSE 1 END;
Or sometimes the developer tries to accomplish the same thing with an overly complex subquery. We can greatly simplify what we’re trying to do with just this query:

UPDATE products SET in_stock = in_stock ^ 1;

The trick is using the caret (“^”), which is the bitwise XOR operator (MySQL, MS SQL Server) with either a “0? or a “1?. For those of you who’s binary math is a bit rusty, remember:

1 ^ 1 = 0
0 ^ 0 = 0
1 ^ 0 = 1
0 ^ 1 = 1

Tuesday, May 3, 2011

Adding style to a file inside grid view dynamically

Label Task_code = (Label)e.Row.FindControl("Lbl_TASK_CODE");
HiddenField task_details = (HiddenField)e.Row.FindControl("Hf_Task_Details");
string[] words = task_details.Value.Split('/');
string Comments = words[0].ToString();
string Extension = words[1].ToString();
string EDR = words[2].ToString();
if (Comments != "0")
{
Task_code.Text = Task_code.Text + "" + "*" + "";
}
if (Extension != "False")
{
Task_code.Text = Task_code.Text + "" + "*" + "";
}
if (EDR != "False")
{
Task_code.Text = Task_code.Text + "" + "*" + "";
}

Appending Values with Eval inside grid view

Value='<%# "Clinton" + Eval("TASK_COMSTATUS") + "Gallagher"%>'>