You are on page 1of 2

Add row in DataTable

DataRow dr = dataSet1.Tables["Customers"].NewRow(); dr ["CustomerID"] = "ALFKI"; dr ["CompanyName"] = "Alfreds Futterkiste"; dataSet1.Tables["Customers"].Rows.Add(dr);

Update data in DataTable


dataSet1.Tables["Customers"].Rows[4]["CompanyName"] = "Updated Company Name"; dataSet1.Tables["Customers"].Rows[4]["City"] = "Seattle";

if Row index is unknown:


DataRow[] customerRow = dataSet1.Tables["Customers"].Select("CustomerID = 'ALFKI'"); customerRow[0]["CompanyName"] = "Updated Company Name"; customerRow[0]["City"] = "Seattle";

Delete row from datatable


dataSet1.Tables["Customers"].Rows[0].Delete();

The Repeater control is used to display a repeated list of items that are bound to the control. The Repeater control may be bound to a database table, an XML file, or another list of items. Repeater has 5 inline template to format it: 1. <HeaderTemplate> 2. <FooterTemplate> 3. <ItemTemplate> 4. <AlternatingItemTemplate> 5. <SeperatorTemplate> HeaderTemplate: This template is used for elements that you want to render once before your ItemTemplate section. FooterTemplate: - This template is used for elements that you want to render once after your ItemTemplate section. ItemTemplate: This template is used for elements that are rendered once per row of data. It is used to display records AlternatingItemTemplate: This template is used for elements that are rendered every second row of data. This allows you to alternate background colors. It works on even number of records only. SeperatorTemplate: It is used for elements to render between each row, such as line breaks.

http://www.c-sharpcorner.com/uploadfile/puranindia/repeater-controls-in-Asp-Net/
What is event bubbling? Server controls like Data grid, Data List, and Repeater can have other child controls inside them. Example Data Grid can have combo box inside data grid. These child control do not raise there events by themselves, rather they pass the event to the container parent (which can be a data grid, data list, repeater), which passed to the page as ItemCommand event. As the child control send events to parent it is termed as event bubbling.

How can we create custom controls in ASP.NET? User controls are created using .ASCX in ASP.NET. After .ASCX file is created you need to two things in order that the ASCX can be used in project:. Register the ASCX control in page using the <%@ Register directive. Example <%@ Register tag prefix="Accounting" Tag name="footer" Src="Footer.ascx" %> Now to use the above accounting footer in page you can use the below directive. <Accounting: footer runat="server" /> What is the use of GLOBAL.ASAX file? It allows to execute ASP.NET application level events and setting application-level variables. What is a SESSION and APPLICATION object? Session object store information between HTTP requests for a particular user, while application object are global across users. Change Master Page Dynamically ?
protected void Page_PreInit(object sender, EventArgs e) { if (Membership.GetUser() == null) //check the user weather user is logged in or not this.Page.MasterPageFile = "~/General.master"; else this.Page.MasterPageFile = "~/myMaster.master"; }

You might also like