Friday, 30 January 2015

Show Bind Data to Asp.net Dropdownlist from Database in C#

   Show Bind Data to Asp.net Dropdownlist from Database in C#

Before implement this example first design one table UserInformation in your database as shown below

Column Name
Data Type
Allow Nulls
UserId
Int (set Identity=true)
No
UserName
varchar(50)
Yes
Location
Varchar(50)
Yes
Once table designed in database write the following code in your aspx page

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>how to show data in dropdownlist from database in asp.net</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<b>Selected UserName:</b>
<asp:DropDownList ID="ddlCountry" runat="server" />
</div>
</form>
</body>
</html>

Now add the following namespaces in code behind
using System;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI.WebControls;

After add namespaces write the following code in code behind

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindContrydropdown();
}
}
/// Bind COuntrydropdown


protected void BindContrydropdown()
{
//conenction path for database
using (SqlConnection con = new SqlConnection("Data Source=SureshDasari;Integrated Security=true;Initial Catalog=MySampleDB"))
{
con.Open();
SqlCommand cmd = new SqlCommand("Select UserId,UserName FROM UserInformation", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
ddlCountry.DataSource = ds;
ddlCountry.DataTextField = "UserName";
ddlCountry.DataValueField = "UserId";
ddlCountry.DataBind();
ddlCountry.Items.Insert(0, new ListItem("--Select--""0"));
con.Close();
}
}



Tuesday, 27 January 2015

How To Set "Pattern Lock" For Your Computer In Windows7/8/XP.

How To Set "Pattern Lock" For Your Computer In Windows7/8/XP.




If you want to amaze your friends with the pattern lock on your computer/Pc.!Then,you have landed on the correct place to learn setting of pattern lock on your computer windows/8/xp.I have tried this trick and liked my friends feelings and looks on their face when i showed a pattern lock on my laptop.I am expecting the same from your friends too.Today,i will teach you how to set the pattern lock for your computer/pc.This is one of the best computer tricks to amaze your friends.

 This pattern lock is completely safe and we can use it with out any problems.Moreover it does not interrupt with the normal lock,you can use both locks and this has a good interface also.

1.Download the software/Application in your computer,which will be in few kb's only. 2.Run it and install it on your computer 3.Open it and set the required settings 4.Then apply those settings and you can change them at any time. Note:- The basic pattern of lock software will be "z" and if you can change it later. 5.Open it and have fun.


How To Lock It?



The locking process is very easy and you need to just press "windows+a" keys to lock it. After locking you will have three modes at the bottom of the lock screen and i will give a clear explanation and working of those three buttons below.

1. First mode will be normal maze mode and the pattern will be visible to every one while you are unlocking your computer.

2.This is the hidden mode,which is recommended to use in public.This mode will not display the pattern you are drawing and android users may be familiar to this one

3.This will be like a coded one and we need to set the code in order to unlock your computer.This is a bit complicated lock and use it for more security.




Website:http://www.xussoft.com
Support: support@xussoft.com

Product Name: XUS PC Lock 4.1.68(ProfessionalEdition)

wordpress facebook theme

                                   wordpress facebook theme


http://murataktas.org/wordpress-facebook-temasi/ 





http://murataktas.org/wordpress-facebook-temasi


5 Ways to Cure any Slow Computer


                                             5 Ways to Cure any Slow Computer

Are you annoyed of your slow and lazy computer? Don't worry, here are some steps that you can take to enhance its performance.
#SlowComputer #lazyComputer#IncreaseComputerSpeed#EnhanceComputerPerformance  




Friday, 16 January 2015

Top 10 ASP.NET Interview Questions and Answers

   Top 10 ASP.NET Interview Questions and Answers

"ASP.NET is a web application development framework for building web sites and web applications that follows object oriented programming approach".Following are the top 10 commonly asked Interview Questions with Answers on ASP.NET:What is the concept of Postback in ASP.NET?A postback is a request se
"ASP.NET is a web application development framework for building web sites and web applications that follows object oriented programming approach".
Following are the top 10 commonly asked Interview Questions with Answers on ASP.NET:
What is the concept of Postback in ASP.NET?
A postback is a request sent from a client to server from the same page user is already working with.
ASP.NET was introduced with a mechanism to post an HTTP POST request back to the same page. It's basically posting a complete page back to server (i.e. sending all of its data) on same page. So, the whole page is refreshed.
Another concept related to this approach is "Callback" that is also asked sometimes during a technical interview question. Click here to understand Postback Vs Callback in ASP.NET.
Difference between ASP.NET WebForms and ASP.NET MVC?
ASP.NET Web Forms uses Page controller pattern approach for rendering layout. In this approach, every page has it's own controller i.e. code-behind file that processes the request. On the other hand, ASP.NET MVC uses Front Controller approach. In this approach a common controller for all pages, processes the requests.
Please follow for detailed information on WebForms Vs MVC.
Please briefly explain ASP.NET Page life Cycle?
ASP.NET page passes through a series of steps during its life cycle. Following is the high-level explanation of life cycle stages/steps.
Initialization: Controls raise their Init event in this stage.Objects and variables are initializes for complete lifecyle of request.
LoadViewState: is a post back stage and loads the view state for the controls that enabled its view state property.
LoadPostBackData: is also a post back stage and loads the data posted for the controls and update them.
Load: In this stage page as well as all the controls raise their Load event. Till this stage all the controls are initialized and loaded. In most of the cases, we are coding this event handler.
RaisePostBackEvent: is again a postback stage. For example, it's raise against a button click event. We can easily put our code here to perform certain actions.
SaveViewState: Finally, controls state is saved in this stage before Rendering HTML.
Render: This is the stage where HTML is generated for the page.
Dispose: Lastly, all objects associated with the request are cleaned up.
For very detailed explanation of Page Life Cycle is explained here.
What is the difference between custom controls and user controls?
Custom controls are basically compiled code i.e. DLLs. These can be easily added to toolbox, so it can be easily used across multiple projects using drag and drop approach. These controls are comparatively hard to create.
But User Controls (.ascx) are just like pages (.aspx). These are comparatively easy to create but tightly couple with respect to User Interface and code. In order to use across multiple projects, we need to copy and paste to the other project as well.

What is the concept of view state in ASP.NET?

As in earlier question, we understood the concept of postback. So, in order to maintain the state between postbacks, ASP.NET provides a mechanism called view state. Hidden form fields are used to store the state of objects on client side and returned back to server in subsequent request (as postback occurs).

Difference between Response.Redirect and Server.Transfer?

In case of Response.Redirect, a new request is generated from client-side for redirected page. It's a kind of additional round trip. As new request is generated from client, so the new URL is visible to user in browser after redirection.
While in case of Server.Transfer, a request is transferred from one page to another without making a round trip from client. For the end user, URL remains the same in browser even after transferring to another page.

Please briefly explain the usage of Global.asax?

Global.asax is basically ASP.NET Application file. It’s a place to write code for Application-level events such as Application start, Application end, Session start and end, Application error etc. raised by ASP.NET or by HTTP Modules.
There is a good list of events that are fired but following are few of the important events in Global.asax:
  • Application_Init occurs in case of application initialization for the very first time.
  • Application_Start fires on application start.
  • Session_Start fires when a new user session starts
  • Application_Error occurs in case of an unhandled exception generated from application.
  • Session_End fires when user session ends.
  • Application_End fires when application ends or time out.

What are the different types of Validation controls in ASP.NET?

In order to validate user input, ASP.NET provides validation server controls. All validation controls inherits from BaseValidator class which contains the common validation properties and methods like ControlToValidate,EnabledIsValidEnableClientScriptValidationGroup,Validate() etc.
ASP.NET provides a range of validation controls:
  • RequiredFieldValidator validates compulsory/required input.
  • RangeValidator validates the range. Validates that input falls between the given range values.
  • CompareValidator validates or compares the input of a control with another control value or with a fixed value.
  • RegularExpressionValidator validates input value against a defined regular expression pattern.
  • CustomValidator allows to customize the validation logic with respect to our application logic.
  • ValidationSummary displays all errors on page collectively.

What are the types of Authentication in ASP.NET?

There are three types of authentication available in ASP.NET:
  • Windows Authentication: This authentication method uses built-in windows security features to authenticate user.
  • Forms Authentication: authenticate against a customized list of users or users in a database.
  • Passport Authentication: validates against Microsoft Passport service which is basically a centralized authentication service.

What are Session state modes in ASP.NET?

ASP.NET supports different session state storage options:
  • In-Process is the default approach. It stores session state locally on same web server memory where the application is running.
  • StateServer mode stores session state in a process other than the one where application is running. Naturally, it has added advantages that session state is accessible from multiple web servers in a Web Farm and also session state will remain preserved even web application is restarted.
  • SQLServer mode stores session state in SQL Server database. It has the same advantages as that of StateServer.
  • Custom modes allows to define our custom storage provider.
  • Off mode disables session storage.
Hopefully, this list of Interview Questions for ASP.NET will be helpful for beginners as well as Professional developers. Please follow here for a Comprehensive list of ASP.NET Interview Questions.

Bhabani Facebook