Contains classes that allow you to create HTML server controls on a Web Forms page, so it allows you to programmatically control the HTML elements on a Web Forms page.
Search This Blog
Friday, March 28, 2014
ASP.NET System Web UI HtmlControls
ASP.NET > System.Web.UI.HtmlControls
Contains classes that allow you to create HTML server controls on a Web Forms page, so it allows you to programmatically control the HTML elements on a Web Forms page.
Contains classes that allow you to create HTML server controls on a Web Forms page, so it allows you to programmatically control the HTML elements on a Web Forms page.
Etichete:
asp.net
Create dynamic table runtime ASP.NET
ASP.NET > System.Web.UI.HtmlControls > HtmlTable
HtmlTable allows programmatic access on the server to the HTML
element.
Example: Create dynamic table runtime ASP.NET
HTML:
Code:
HtmlTable allows programmatic access on the server to the HTML
Example: Create dynamic table runtime ASP.NET
HTML:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication2.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Panel ID="Panel1" runat="server">
</asp:Panel>
</div>
</form>
</body>
</html>
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
namespace WebApplication2
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
HtmlTable dTable = new HtmlTable();
dTable.Border = 1;
int tRow;
int tCell;
for (tRow = 0; tRow < 10; tRow++)
{
HtmlTableRow dTRow = new HtmlTableRow();
for (tCell = 0; tCell < 5; tCell++)
{
HtmlTableCell dTCell = new HtmlTableCell();
dTCell.InnerText = "Row: " + Convert.ToString(tRow + 1) + " Col: " + Convert.ToString(tCell + 1);
dTRow.Controls.Add(dTCell);
}
dTable.Controls.Add(dTRow);
}
Panel1.Controls.Add(dTable);
}
}
}
Etichete:
asp.net
C# Keywords
C# > Keywords
Keywords are reserved identifiers used by compiler.
Operator
Contextual
Keywords are reserved identifiers used by compiler.
- cannot be used as identifiers in your program unless they include @ as a prefix (@then is a valid identifier)
- contextual keywords have special meaning only in a limited program context and can be used as identifiers outside that context
Operator
Contextual
Etichete:
c#
Null keyword C#
Null represent reference that does not refer to any object.
- default value of reference type variables
- ordinary value types cannot be null
Example
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public class TestClass
{
public void TestMethod() { }
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
TestClass tc=null;
tc = new TestClass();
tc.TestMethod(); // You can call TestMethod method.
tc = null; // set tc to null => the object is no longer accessible and can now be garbage collected
string s1 = null;
//int k = null; // Error Cannot convert null to 'int' because it is a non-nullable value type
int? k = null; // use a nullable value type instead OK
}
}
}
Etichete:
c#
Tuesday, March 25, 2014
Filter with LINQ DataTable C#
C# > System.Data > DataTable > Filter with LINQ
Example:
Example:
DataTable dt = new DataTable("table");
dt.Columns.Add("id", Type.GetType("System.Int32"));
dt.Columns.Add("name", Type.GetType("System.String"));
DataRow dr = dt.NewRow();
dr["id"] = 1;
dr["name"] = "john";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["id"] = 2;
dr["name"] = "dan";
dt.Rows.Add(dr);
DataTable tbl = (from DataRow dr1 in dt.Rows
where dr1["id"].ToString() == "1"
select dr).CopyToDataTable();
Etichete:
c#
Friday, March 21, 2014
DateValue Visual Basic Example
VB.NET > Functions > DateValue
Returns a date value containing the date information represented by a string.
Example
Returns a date value containing the date information represented by a string.
Example
Dim dt As Date
dt = DateValue("March 21, 2014")
MessageBox.Show(dt)
Etichete:
VB.NET
Oracle Sequence Example
Oracle > Sequence
Sequences are database objects from which multiple users can generate unique integers. The sequence generator generates sequential numbers, which can help to generate unique primary keys automatically, and to coordinate keys across multiple rows or tables.
Sequences are database objects from which multiple users can generate unique integers. The sequence generator generates sequential numbers, which can help to generate unique primary keys automatically, and to coordinate keys across multiple rows or tables.
Example:
CREATE SEQUENCE order_sequence
INCREMENT BY 1
START WITH 1
NOMAXVALUE
NOCYCLE
CACHE 10;
INSERT INTO orders (order_no)
VALUES (order_sequence.NEXTVAL);
Etichete:
Oracle/PLSQL
Wednesday, March 19, 2014
Var C# Example
C# > Types > Var
Var is implicitly typed.
An implicitly typed local variable is strongly typed, but
the compiler determines the type.
Example
Var is implicitly typed.
An implicitly typed local variable is strongly typed, but
the compiler determines the type.
Example
// var is required because the select clause specifies an anonymous type
var query = from prod in products
where prod.Category == "shoes"
select new { prod.Name, prod.Price };
// var is required because item is an anonymous type
foreach (var item in query)
{
}
Etichete:
c#
C# Void Type Example
C# > Types > Void
Void specifies that the method doesn't return a value.
Example
Void specifies that the method doesn't return a value.
Example
private void Log(string msg)
{
// log method
}
Etichete:
c#
DateDiff Visual Basic Example
VB.NET > Functions > DateDiff
Returns a value specifying the number of time intervals
between two dates.
Example:
Returns a value specifying the number of time intervals
between two dates.
Example:
Dim dt1 As Date = #3/1/2014#
Dim dt2 As Date = #4/1/2014#
MessageBox.Show("Day diff: " & DateDiff(DateInterval.Day, dt1, dt2) & " Week diff: " & DateDiff(DateInterval.Weekday, dt1, dt2))
Etichete:
VB.NET
Subscribe to:
Posts (Atom)