c# and .NET Interview Questions Shivprasad Koirala



Comments



Description

c# and .NET interview questions Shivprasad Koirala c# and . NET interview questions Shivprasad Koirala c# and .NET interview questions Friday, June 17, 2011 About Me Learn MVC (Model view controller) Step by Step in 7 days – Day 1 Contents So, what’s the agenda? So why MVC when ASP.Net behind code was so good? Problem number 1:- UNIT Testing Problem 2 :- The reality of separation of code and UI Our HERO MVC (Model, view and controller) Pre-requisite for MVC Lab1:- Creating a simple hello world ASP.NET MVC Application Video demonstration for Lab 1 Step1:- Create project Step 2:- Add controller http://computerauthor.blogspot.com/ (1 of 36) [6/25/2011 4:48:52 PM] Shivprasad Koirala Visit us @ www.questpond.com or call us at 02266752917 View my complete profile c# and .NET interview questions Shivprasad Koirala Step 3:- Add View Step 4:- Run the application So what’s in the next Lab? Lab2:- Passing data between controllers and views Video demonstration for Lab 2 Step1:- Create project and set view data Step 2:- Display view data in the view. So what’s in the next Lab? Lab 3:- Creating a simple model using MVC Video demonstration for Lab 3 Step1:- Create a simple class file Step2:- Define the controller with action Step3:- Create strongly typed view using the class Step 4 :- Run your application So what’s in the next Lab? Lab 4:- Creating simple MVC data entry screen Video demonstration for Lab 4 Step1:- Creating your data entry ASPX page Step2:- Creating the controller Step3:- Create the view to display the customer object Step 4:- Finally run the project So what’s in the next Lab? Lab 5:- using HTML helper to create views faster Step 1:- Create the Customer class Step2:- Creating the input HTML form using helper classes Step 3:- Create a strong typed view by using the customer class Step4:- Creating the controller class. What’s for the second day? So, what’s the agenda? As the article name says learn MVC, so the agenda is simple we are going to learn ASP.NET MVC • in 7 days. The way we will learn MVC in this series of article is by doing Labs, looking at detail steps of how to achieve those labs and also looking at demonstrative videos. http://computerauthor.blogspot.com/ (2 of 36) [6/25/2011 4:48:52 PM] c# and .NET interview questions Shivprasad Koirala This complete article is divided in to 7 days with 42 hands on labs and every day we will do 6 labs which will help us achieve our goals. So get ready for day 1. In day1 below is our agenda we will start with introduction, do a simple hello world and finally in the 6th lab we will create a simple customer data entry screen using HTML helper classes. You can watch my .NET interview questions and answers videos on various sections like WCF, Silver light, LINQ, WPF, Design patterns, Entity framework etc So why MVC when ASP.Net behind code was so good? I am sure all ASP.NET love the behind code concept. Accepting something new like MVC will not convince them. So let’s analyze the problems with the current behind code stuff. When we generally talk about ASP.NET application built on tiered architecture they are divided in four parts UI (ASPX pages), behind code (ASPX.CS pages), Middle tier (.NET classes) and finally Data layer. If you see from the aspect of code distribution major code which has logic is in the middle tier or in the behind code (APX.CS files). The UI or ASPX files are HTML files which is more of UI design and data access logic are pretty much standard components like enterprise data blocks, entity data contexts etc. http://computerauthor.blogspot.com/ (3 of 36) [6/25/2011 4:48:52 PM] NET behind code is completely tied up with ASP. The data logic classes are already time tested components like enterprise data block.NET Httpcontext object which makes unit testing very difficult.com always boasted about how the ASP. view data objects.UNIT Testing From the aspect of unit testing we can exclude the data logic and the UI HTML. Just think how do I unit test the below behind ASP. The behind code has lot of action and testing them is one of the most important things. In case you have custom data access layer it will be still easy to test them as they are simple . ASP.NET classes. How do I create a Http context object . rhino mocks etc but still its cryptic and the complication increases with session variables.c# and .microsoft. entity data context or LINQ data context.NET interview questions Shivprasad Koirala Let’s try to analyze the problems. Even though www. how do I simulate the sender and eventargs objects of the button clicks etc. So we really do not have to put lot of effort on testing the DAL separately.NET UI controls creating further confusion. Problem number 1:.NET behind code and do unit testing on them.NET behind code was separate from the UI. in practical sense it’s very difficult to decouple an ASP.NET code. The ASP.blogspot.NET class like data logic so you can easily do unit testing using VSTS or NUNIT. Now comes the most important one the behind code. From a longer run perspective this would not be a great choice.com/ (4 of 36) [6/25/2011 4:48:52 PM] . There is no logic in testing on ASPX HTML as such it’s more of look and feel. The only way to invoke these codes are by doing manual test.Many developers would talk about mock test. FYI: . The middle tier is again a simple . http://computerauthor. view and controller) That’s where MVC comes to rescue.aspx and when called via HTTP GET should display in tree view. Just think how can we do the same using the current behind code.NET class called as controller. Microsoft did said first that the behind code is different and the UI is different but then they are probably separate physical files only and one cannot just exist without other. Our HERO MVC (Model.c# and . For instance let’s say the same button click code when called via HTTP POST should display using displayinvoice.blogspot. The behind code is moved to a simple .com/ (5 of 36) [6/25/2011 4:48:52 PM] . Yes. http://computerauthor.NET interview questions Shivprasad Koirala Problem 2 :. Any user request first comes to the controller class.CS cannot be decoupled in reality thus reducing reusability.The reality of separation of code and UI As said previously the ASPX and the ASPX. In other words we would like to reuse the behind code. the controller class then invokes the model and attaches the model to the view for display to the end user. http://computerauthor. So let’s see how we can create MVC application using MVC template provided by visual studio. These include ASP.So we will create a simple controller.asp.net/mvc/ . attach the controller to simple index. aspx page and view the display on the browser.NET interview questions Shivprasad Koirala As this controller class is a simple .NET MVC 2 from http://www. you must also download and install ASP.NET class we can reuse and also do unit testing easily.blogspot. In case you want spend more time with your family rather than reading the complete article you can watch the below 5 minute youtube video. These do not include ASP.com/ (6 of 36) [6/25/2011 4:48:52 PM] . Lab1:.NET MVC 2 template by default. • Visual Studio 2008 SP1 (any edition) or the free Visual Web Developer 2008 Express with SP1. Pre-requisite for MVC Before we start the day lets ensure that you have all the ingredients to create a MVC application. So once you have all your pre-requisite its time to start with the first lab.Creating a simple hello world ASP.NET MVC Application Video demonstration for Lab 1 In this lab we will create a simple hello world program using MVC template. • Visual Studio 2010 or the free Visual Web Developer 2010 Express.c# and .NET MVC 2 by default. NET interview questions Shivprasad Koirala Step1:. http://computerauthor.c# and . models and views.blogspot.Create project Create a new project by selecting the MVC 2 empty web application template as shown in the below figure. Once you click ok. you have a readymade structure with appropriate folders where you can add controllers.com/ (7 of 36) [6/25/2011 4:48:52 PM] . Once you add the new controller you should see some kind of code snippet as shown in the below snippet.Add controller So let’s go and add a new controller as shown in the below figure.blogspot. } } http://computerauthor.NET interview questions Shivprasad Koirala Step 2:.com/ (8 of 36) [6/25/2011 4:48:52 PM] . public class Default1Controller : Controller { // // GET: /Default1/ public ActionResult Index() { return View().c# and . Add View Now that we have the controller we need to go and add the view.blogspot. <html xmlns="http://www. In the below HTML code snippet I have added “This is my first MVC application”.w3. So click on the Index function which is present in the control and click on add view menu asshown in the below figure.NET interview questions Shivprasad Koirala Step 3:. Once you click on the ok button of the view. The add view pops up a modal box to enter view name which will be invoked when this controller is called as shown in the figure below.org/1999/xhtml" > http://computerauthor.com/ (9 of 36) [6/25/2011 4:48:52 PM] . you should see a simple ASPX page with the below HTML code snippet. For now keep the view name same as the controller name and also uncheck the master page check box.c# and . blogspot.NET interview questions Shivprasad Koirala <head runat="server"> <title>Index</title> </head> <body> <div> This is my first MVC application </div> </body> </html> Step 4:.c# and .This error is obvious because we have not invoked the appropriate controller /action. it’s time to see how we can pass data from controllers to views.Run the application If you do a CNTRL + F5 you should see a error as shown in the below figure. So what’s in the next Lab? Now that we have created a simple MVC hello world. The first hit comes to the http://computerauthor.com/ (10 of 36) [6/25/2011 4:48:52 PM] . If you append the proper controller on the URL you should be able to see the proper view. e. ASP.Create project and set view data http://computerauthor.blogspot.NET developer your choice would be to use session variables. For MVC we would like to see scope limited to controller and the view. In other words we would like to maintain data when the hit comes to controller and reaches the view and after that the scope of the data should expire.Passing data between controllers and views The controller gets the first hit and loads the model.NET session management object. Step1:. Most of the time we would like to pass the model to the view for display purpose.NET MVC framework i. ViewData.c# and . The problem with using ASP.NET interview questions Shivprasad Koirala controller which will load your business objects or model and you would like to transfer these objects to the view to display them. view state or some other ASP. Video demonstration for Lab 2 Below is a simple youtube video which demonstrates the lab for view data. As an ASP.com/ (11 of 36) [6/25/2011 4:48:52 PM] . That’s where the new session management technique has been introduced in ASP. Lab2:. In this video we will see how we can share data between controller and the view using view data.NET session or view state object is the scope.NET session objects have session scope and view state has page scope. So we will create a simple controller. record the current data in a view data variable and then display the same in the view using the percentage tag. Creating a simple model using MVC Video demonstration for Lab 3 Below is a video demonstration for the same. view and controller) in action. } } Step 2:. In the controller set the viewdata variable as shown in the below code snippet and kick of the view. name and amount. the next lab is to create a simple model and see all the 3 MVC entities (i.com/ (12 of 36) [6/25/2011 4:48:52 PM] .e. In this lab we will create a simple customer model.NET interview questions Shivprasad Koirala So the first step is to create a project and a controller. right click on the model folder and click on add new item as shown in the below figure. http://computerauthor.ToString().Now.c# and . Lab 3:. flourish the same with some data and display the same in a view. So to display the view we need to use the <%: tag in the aspx page as shown in the below code snippet. <body> <div> <%: ViewData["CurrentTime"] %> </div> </body> So what’s in the next Lab? So now that we know how to pass data using view data. Step1:. One important point to note is the view does not have a behind code.Display view data in the view. return View(). model.Create a simple class file The first step is to create a simple customer model which is nothing but a class with 3 properties code. The next thing is to display data in the view by using the percentage tag. Create a simple MVC project. public class DisplayTimeController : Controller { // // GET: /DisplayTime/ public ActionResult Index() { ViewData["CurrentTime"] = DateTime.blogspot. blogspot. Create the class with 3 properties as shown in the below the code snippet. private double _Amount.NET interview questions Shivprasad Koirala From the templates select a simple class and name it as customer. } } public string Name { get { return _Name. public string Code { set { _Code = value. } get { return _Code.com/ (13 of 36) [6/25/2011 4:48:52 PM] .c# and . } set http://computerauthor. public class Customer { private string _Code. private string _Name. blogspot. http://computerauthor. } } public double Amount { set { _Amount = value.com/ (14 of 36) [6/25/2011 4:48:52 PM] . return View("DisplayCustomer". public ViewResult DisplayCustomer() { Customer objCustomer = new Customer(). objCustomer. So right click on the view folder and click add view. objCustomer.Define the controller with action The next step is to add the controller and create a simple action display customer as shown in the below code snippet. …. check create a strongly typed view and bind this view to the customer class using the dropdown as shown in the below figure. In the action we created the object of the customer class.c# and . Give a view name. } } Step3:.Id = 12.NET interview questions Shivprasad Koirala { _Name = value.. You should see a drop down as shown in the below figure.Create strongly typed view using the class We need to now join the points of MVC by creating views. objCustomer.objCustomer). } } } Step2:. Import the model namespace in the controller class.Amount = 90. flourished with some data and passed the same to a view named as “DisplayCustomer” public class CustomerController : Controller { …. } get { return _Amount.34.CustomerCode = "1001". c# and .NET interview questions Shivprasad Koirala The advantage of creating a strong typed view is you can now get the properties of class in the view by typing the model and “.CustomerCode %> <br /> <% if (Model. Below is the view code which displays the customer property value.blogspot.Amount > 100) {%> This is a priveleged customer <% } else{ %> This is a normal customer <%} %> </div> </body> Step 4 :.Id %> <br /> The customer Code is <%= Model.com/ (15 of 36) [6/25/2011 4:48:52 PM] .Run your application http://computerauthor. <body> <div> The customer id is <%= Model. We have also put an if condition which displays the customer as privileged customer if above 100 and normal customer if below 100.” as shown in the below figure. In this lab we will create a simple customer data entry screen as shown in the below figure using MVC template. So what’s in the next Lab? In this sample we flourished the customer object from within the controller. Lab 4:.in the next lab we will take data from an input view and display the same. Inother words we will see how to create data entry screens for accepting data from views.blogspot. hit cntrl + f5 and pat yourself for one more lab success.Creating simple MVC data entry screen Every project small or big needs data entry screens.com/ (16 of 36) [6/25/2011 4:48:52 PM] .c# and . As soon as the end user enters details and submits data it redirects to a screen as shown below.NET interview questions Shivprasad Koirala Now the “D” thing. If he entered amount is less than 100 it displays normal customer or else it displays privileged customer. http://computerauthor. Step1:.com/ (17 of 36) [6/25/2011 4:48:52 PM] . The most important point to note in the below code snippet is that the action is pointing to the controller action i. <form action="DisplayCustomer" method="post"> Enter customer id :.c# and .Creating your data entry ASPX page The first step is to create the data entry page using the simple HTML form action tag as shown in the below code snippet.e ‘DisplayCustomer’. http://computerauthor.NET interview questions Shivprasad Koirala Video demonstration for Lab 4 Below is a simple video demonstration for this lab.blogspot. flourish the object and send the object to the view.Creating the controller The above defined form action will post to the controller class and on the function “DisplayCustomer”. Below is the code snippet of displaycustomer which flourishes the customer object by collecting data from request. So we need to get the data from the HTML controls.<input type="text" name="CustomerCode" /><br /> Enter customer Amount :-<input type="text" name="Amount" /><br /> <input type="submit" value="Submit customer data" /> </form> Step2:.<input type="text" name="Id" /> <br /> Enter customer code :.form and sends the object to the view ‘displaycustomer. Form["Id"]. ….. Give a view name.c# and . http://computerauthor.” as shown in the below figure.ToString()). objCustomer. objCustomer). objCustomer.CustomerCode = Request.Form["Id"].So right click on the view folder and click add view.ToString()). You should see a drop down as shown in the below figure.Create the view to display the customer object The next step is to create the “DisplayCustomer” view. check create a strongly typed view and bind this view to the customer class using the dropdown as shown in the below figure. The advantage of creating a strong typed view is you can now get the properties of class in the view by typing the model and “.ToInt16(Request. [HttpPost] public ViewResult DisplayCustomer() { Customer objCustomer = new Customer(). return View("DisplayCustomer".ToDouble(Request. . objCustomer. } } Step3:.Form["Amount"].Id = Convert.blogspot.ToString().com/ (18 of 36) [6/25/2011 4:48:52 PM] .Amount = Convert.NET interview questions Shivprasad Koirala public class CustomerController : Controller { …. Id %> <br /> The customer Code is <%= Model.Amount > 100) {%> This is a priveleged customer <% } else{ %> This is a normal customer <%} %> </div> </body> Step 4:.c# and .CustomerCode %> <br /> <% if (Model.NET interview questions Shivprasad Koirala Below is the view code which displays the customer property value. You should be also able to test above 100 and below 100 scenarios http://computerauthor. We have also put an if condition which displays the customer as privileged customer if above 100 and normal customer if below 100.blogspot.Finally run the project Final step is to run the project and see the output.com/ (19 of 36) [6/25/2011 4:48:52 PM] . <body> <div> The customer id is <%= Model. ….c# and .NET interview questions Shivprasad Koirala So what’s in the next Lab? In this lab we created a simple data entry screen which helped us flourish the customer object. In other words.<input type="text" name="Id" /> <br /> Enter customer code :. It’s like going back to dark ages where developers used to write HTML tags in notepad. http://computerauthor.. objCustomer).using HTML helper to create views faster In our previous lab we created a simple customer data entry screen. objCustomer. return View("DisplayCustomer". flourishing the object etc.Form["Id"]. <form action="DisplayCustomer" method="post"> Enter customer id :.blogspot.<input type="text" name="CustomerCode" /><br /> Enter customer Amount :-<input type="text" name="Amount" /><br /> <input type="submit" value="Submit customer data" /> </form> • Added to it lot of manual code was also written in the controller to flourish the object and send data to the MVC view.ToString()). less productive. This customer object was then passed to the view for display. In the next lab we see how HTML helper classes help to minimize many of these manual coding and thus increasing productivity. Lab 5:. If you closely watch the current lab we have done lot of coding i.ToString(). objCustomer. objCustomer.Amount = Convert.ToDouble(Request.CustomerCode = Request.Id = Convert.ToInt16(Request. [HttpPost] public ViewResult DisplayCustomer() { Customer objCustomer = new Customer().Form["Amount"].ToString()).e. We completed the lab successfully but with two big problems:• The complete HTML code was written manually.com/ (20 of 36) [6/25/2011 4:48:52 PM] . public class CustomerController : Controller { …. creating the HTML screens . . It would be great if there was some kind of automation.Form["Id"]. "Customer".c# and . below goes the code snippet for the same. Step2:.Creating the input HTML form using helper classes HTML helper classes have readymade functions by which you can create HTML controls with ease.BeginForm("DisplayCustomer". labels.Create the Customer class Create a simple customer class .com/ (21 of 36) [6/25/2011 4:48:52 PM] . Go to any MVC view and see the intellisense for HTML helper class you should see something as shown in the below figure. controller name (actual controller name) and HTTP posting methodology (Post or GET). list box etc just by invoking the appropriate function.FormMethod. In order to create the form tag for HTML we need to use “Html.NET interview questions Shivprasad Koirala } } In this lab we will see how to use MVC HTML helper classes to minimize the above manual code and increase productivity Step 1:. …..HTML input fields will go here <%} %> The above code will generate the below HTML <form action="DisplayCustomer" method="post"> …. </form> The HTML helper “beginform” takes three input parameters action name (Method inside the controller). <% using (Html.Post)) {%> -. By using HTML helper class you can create any HTML control like textbox.blogspot. please refer Lab 5 for the same..BeginForm” . http://computerauthor. com/ (22 of 36) [6/25/2011 4:48:52 PM] .<%= Html. Enter customer id :.c# and . simply use the “TextBox” function of html helper class as shown in the below code. The final thing is the controller code. The customer object will be auto flourished as we have used the HTML helper classes. } Enjoy your output for different condition of customer amount entered.Create a strong typed view by using the customer class Step4:.Post)) { %> Enter customer id :.<%= Html. So once you have created the view using the HTML helper classes it’s time to attach the customer class with view .TextBox("CustomerCode".<%= Html.blogspot.Model) %><br /> Enter customer Amount :.TextBox("Id".Model) %><br /> <input type="submit" value="Submit customer data" /> <%} %> Step 3:.Model)%> <br /> The above code snippet will generate the below HTML code. <% using (Html.Creating the controller class.TextBox("Id". http://computerauthor.FormMethod.<%= Html. Enter customer id :. it’s all hidden and automated.Model)%> <br /> Enter customer code :. The controller code now becomes very simple. In this way you can create any HTML controls using the HTML helper class functions. You will create the controller class as we did in Lab 4 but we do not need to write any kind of code for connecting the HTML screens with controller. please refer lab 5 for the same.TextBox("Amount".NET interview questions Shivprasad Koirala If you want to create a text box.<input type="text" name="Id" /> <br /> To create a data entry screen like the one shown below we need to the use the below code snippet. [HttpPost] public ActionResult DisplayCustomer(Customer obj) { return View(obj).BeginForm("DisplayCustomer"."Customer". com/ (23 of 36) [6/25/2011 4:48:52 PM] .In what scenarios do we define a constructor private ? http://computerauthor. MVC Controller attributes and lot more.blogspot. What’s for the second day? In the next labs we will talk about URL routing. Posted by Shivprasad Koirala at 6:37 AM 0 comments Saturday.c# and . June 11. ease of MVC unit testing.NET interview questions Shivprasad Koirala So have a toast of beer for completing your first day of MVC labs. so take rest and I need to work hard to get you the second day labs. 2011 C# interview questions :. The next lab will bit more advanced as compared to the first day. boxing and unboxing ? Stack and heap are memory types in an application.What are stack . http://computerauthor. While heap stores data types like string and objects. When value type is moved to a reference type it’s called as boxing. Value types contain actual data while reference types contain pointers and the pointers point to the actual data. Attaching to the above one more c# interview which comes up is What is boxing and unboxing . The vice-versa is termed as unboxing. object o = null. Value types are are your normal data types like int . “i” and “y” are stored in a stack and the last variable “o” is stored in heap. heap . Below is a simple video which explains the above concept practically. double . double and reference types are all objects. Please click here to see more C# interview questions Posted by Shivprasad Koirala at 6:11 AM 0 comments .c# and . reference types .blogspot. void MyFunction() { int i = 1. // This is stored in stack. Boolean etc.NET interview questions :. bool . Stack memory stores data types like int .NET interview questions Shivprasad Koirala We define a constructor private in the following scenarios:• We want to restrict the client to not create objects. below is the video which explains the same. value . Value types are stored on stack while reference types are stored on heap. For instance when the below code runs the first two variables i. // This is stored in heap.com/ (24 of 36) [6/25/2011 4:48:52 PM] . } // after this end the stack variable memory space is reclaimed while // the heap memory is reclaimed later by garbage collector. int y = i.e. // This is stored in stack. • In case of singleton patterns where we want only instance of the object to be created. 2011 . replacing. extracting and modifying text data. Once you have described these patterns you can use them to do searching.c# and .com/ (25 of 36) [6/25/2011 4:48:52 PM] .blogspot. http://computerauthor.What are regular expressions in .NET interview questions Shivprasad Koirala Please click here to see more C# interview questions Posted by Shivprasad Koirala at 5:24 AM 0 comments Thursday. June 9.NET ? Do view our 15 minutes video on regex as below C# Regex or regular expression helps us to describe complex patterns in texts.NET interview questions :. NET interview Questions .NET interview questions Posted by Shivprasad Koirala at 10:03 PM 0 comments Wednesday. Finally search the pattern over the data to see if there are matches.Show us simple insert. The first step is to import the namespace for regular expressions.NET interview questions Shivprasad Koirala Below is a simple sample of how to implement regex .RegularExpressions.Net / C# interview questions Posted by Shivprasad Koirala at 7:31 AM 0 comments Monday. http://computerauthor. June 1. May 31. MessageBox. 2011 Demo of Button and LinkButton control in ASP.Text.com/ (26 of 36) [6/25/2011 4:48:52 PM] .NET interview questions and ASP. The next thing is to create the regex object with the pattern. June 6. Please click here to see more C# interview questions Regards.IsMatch(“shivkoirala”).NET interview questions Posted by Shivprasad Koirala at 10:29 PM 0 comments Tuesday. using System. Regex obj = new Regex(“[a-z]{10}”).NET See 500 videos on c# and .Show(obj. Visit Authors blog for more . 2011 .blogspot. 2011 What is WCF One way contract ? See 500 videos on c# and .ToString()). In case the pattern is matching the ‘IsMatch’ will return true. The below pattern specifies to search for alphabets between a-z with 10 length.NET/ASP.c# and . com/ (27 of 36) [6/25/2011 4:48:52 PM] . http://computerauthor.blogspot.NET interview questions Shivprasad Koirala update and delete operation using LINQ? Answer: Let us assume that we have the following table of Student with their respective fields.dbml file like below diagram.c# and . Add > New item > select LINQ to SQL Classes. Once you have done creating the form.NET empty web application. As soon as you click on add a new window will appear from that just click on server explorer expand the data connection and select your database then drag and drop the table on the . First open visual studio > New > project > select ASP. Add > New item > select Web Form and create a simple form like below. now you have to add LINQ to SQL Classes in your project. blogspot.Linq. usingSystem. http://computerauthor. usingSystem.StudentAdd = TextBox2. StudentObjStud = newStudent().Data.c# and .Write("Record Successfully Inserted"). publicstring Name { get{ _Name = value.SubmitChanges().StudentName = TextBox1.GetTable(). EventArgs e) { DataClasses1DataContextObjDataContext = newDataClasses1DataContext().} } } } Write code for insert update and delete with their respective buttons. namespaceLinq_to_insert { [Table(Name="Student")] publicclassClass1 { privatestring _Name. privatestring _Add.NET interview questions Shivprasad Koirala Now you have to add a class library file in your project. For adding record. ObjDataContext.} get{return _Name.InsertOnSubmit(ObjStud). } get{return _Add.Linq. protectedvoidbtnAdd_Click(object sender.ToString().} } publicstring Add { set{ _Add = value. Response.Mapping.Text. Add > New item > select Class. ObjStud. ObjDataContext.com/ (28 of 36) [6/25/2011 4:48:52 PM] .Data.Text. ObjStud. StudentName == Name1).DeleteOnSubmit(delete). protectedvoidbtnDelete_Click(object sender.amp.amp. string Address = TextBox2.SubmitChanges().Students.amp. Response.amp.amp.Write("Record Successfully Updated"). var delete = ObjDataContext.StudentAdd = Address.Text.Students.Write("Record Successfully deleted").ToString().NET and ASP.Students.Text.amp.amp.gt.NET interview Question Posted by Shivprasad Koirala at 9:22 AM 0 comments Home Subscribe to: Posts (Atom) Older Posts http://computerauthor. Response.amp.lt.amp.amp.br&amp. } For deleting record.amp. Please click here to see more .NET interview questions Shivprasad Koirala } For updating record.amp. string Name1 = TextBox1.amp. EventArgs e) { DataClasses1DataContextObjDataContext = newDataClasses1DataContext(). &amp. ObjDataContext. var Update = ObjDataContext. StudentObjStud = newStudent().StudentName == Name1). ObjDataContext. string Name1 = TextBox1. StudentObjStud = newStudent().amp.amp.Single(p =>p.amp.amp.amp.NET interview questions Regards. } You will be also interested in watching the below video. which are also asked in most of the interviews and favourable question of interviewers.com/ (29 of 36) [6/25/2011 4:48:52 PM] .blogspot. ObjDataContext.Text.amp.amp.amp.SubmitChanges().amp.c# and . protectedvoidbtnUpdate_Click(object sender. Update. EventArgs e) { DataClasses1DataContextObjDataContext = newDataClasses1DataContext(). Visit Authors blog for more .NET and ASP.amp.Single(s =>s.amp. Powered by Blogger. C# interview questions :.com/ (30 of 36) [6/25/2011 4:48:52 PM] ..c# and .blogspot.What are stack . ....NET interview questions :.. . http://computerauthor.. heap .NET interview questions Shivprasad Koirala Blog Archive ● ▼ 2011 (222) r ▼ June (6) ■ ■ ■ ■ ■ r r r r r ► ► ► ► ► May (89) April (62) March (26) February (23) January (16) ■ Learn MVC (Model view controller) Step by Step in .NET ● ► 2010 (48) ► 2009 (33) ► 2008 (30) ► 2007 (60) ► 2006 (1) ● ● ● ● Simple template.In what scenarios do we . What is WCF One way contract ? Demo of Button and LinkButton control in ASP.What are regular expre.. Template images by gaffera..NET interview questions :. c# and .NET interview questions Shivprasad Koirala http://computerauthor.blogspot.com/ (31 of 36) [6/25/2011 4:48:52 PM] . com/ (32 of 36) [6/25/2011 4:48:52 PM] .c# and .NET interview questions Shivprasad Koirala http://computerauthor.blogspot. com/ (33 of 36) [6/25/2011 4:48:52 PM] .c# and .NET interview questions Shivprasad Koirala http://computerauthor.blogspot. NET interview questions Shivprasad Koirala http://computerauthor.c# and .com/ (34 of 36) [6/25/2011 4:48:52 PM] .blogspot. NET interview questions Shivprasad Koirala http://computerauthor.c# and .com/ (35 of 36) [6/25/2011 4:48:52 PM] .blogspot. blogspot.c# and .com/ (36 of 36) [6/25/2011 4:48:52 PM] .NET interview questions Shivprasad Koirala http://computerauthor.
Copyright © 2024 DOKUMEN.SITE Inc.