CS-dotnet

You can use the following url to brush up on your c# skills

See the list of c# questions

How to stream an object as XML to a string
Controlling root and root field name
Controlling array elements
More sample code
XmlArrayItem

2) gridview onrowcommand

9-Jun-07

How to fire actions from a gridview
gridview onrowcommand
datakeys
buttonfield
buttonfieldtype
commandname

3) GridView samples

6-Jun-07

GridView samples

4) aspire.net samples

6-Jun-07

aspire.net samples

Naming controls in aspx pages

Things you shouldn't be asking in asp.net

Feature changes in Asp.net 2.0

How come runat is needed at high level tags?

9) gridview selectedindex

28-May-07

gridview selectedindex

10) Sample sql syntax

24-May-07

Sample sql syntax

Masterpages are keys in constructing websites in asp.net. They provide the background for a website such as the top banners, left hand navigation, footer etc. In this exercise you will need to

  1. Create a basic empty website
  2. create a main master page (banner, left hand menu, footer)
  3. create a web page that will use that master page
  4. Create a child/nested master page (provide a page menu on the right)
  5. create a web page that uses the nested master

creating a table in oracle

asp.net validation basics

asp.net masterpages

asp.net column gridview widths

asp.net populating, working with datatable objects

How does data binding work in a templated item

asp.net dataview empty datasource display header footer

asp.net: how to submit a web fom

asp.net: Viewstate and dynamically added controls

How can I retrieve the form elements on serverside in dotnet

asp.net what happens to the view state of data variables on the page?

Introduction

For an experienced html web programmer it shoudl be really quick to start writing code in any framework as the concepts are similar. This article will give you a quick start to start developing web pages while highlighting the important elements with out fluff. This information is distilled from a number of web sources and also books.

Prerequisites

it is assumed that you are familiar with the general idea of asp.net where html controls are represented as server side control objects. The web page with an extension of .aspx will contain the placement and configuration of these control. The codebehind file contains the manipulating logic for these controls.

This exercise

The goal of this exercise is to display the output of a select statement in a data grid. Make one of the columns hyperlinked so that one can see the details in a separate web page. The deliverables are two aspx pages with their respective code behind files.

what's up with asp.net isValid function

25) data binding samples

15-May-07

data binding samples


class a{};
object o;
if (o is a)
{
do something;
}

is it possible to add an edit field to a datacontrolfield

How can I look up a class ref quickly in dotnet

class a
{
    a():base(){}
    a(string b):this(){}
    a(int a): this("hello") {}
}
c# strings
Equivalence
Splitting

32) adding template columns

27-Apr-07

adding template columns

33) oracle 10g

21-Apr-07

oracle 10g

where does console output go for asp.net web applications

How can I add an existing project to a website solution

How can I use hyperlinkfield in dataview

what is the Data Binding Syntax in ASP.NET 2.0

How come I dont see web.config in visual studio 2005

How best to create a solution for web site projects

what are the default methods on a page object

Anatomy of an asp.net web page

Randy Connolly
Scott Allen
Dino Esposito
Scott Guthrie
Jimmy Nilsson
Ted Pattison
Fritz Onion
Scott Mitchell
Rick Strahl

Important for googling

how to work with dotnet table control?

basic class structure in c#

This article will address the following

Overloading
virtual and overriding
hiding
return types

The plot seems thicker than what the subject seem to indicate

A simple aspx page with a datagrid


<h2>A sample data grid</h2>

<asp:GridView ID="testGrid" runat="server">
</asp:GridView>

Sample code for binding to this dataset


public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //this.testTable
        this.testGrid.DataSource = getSampleDataset();
        this.testGrid.DataBind();
    }
    private DataSet getSampleDataset()
    {
        DataSet ds = new DataSet();
        string xmlData = "<XmlDS>";
        xmlData+= "<table1><col1>Value1</col1><col2>value</col2></table1>";
        xmlData += "<table1><col1>Value2</col1><col2>value</col2></table1>";
        xmlData += "<table1><col1>Value2</col1><col2>value</col2></table1>";
        xmlData += "<table1><col1>Value2</col1><col2>value</col2></table1>";
        xmlData += "<table1><col1>Value2</col1><col2>value</col2></table1>";
        xmlData+= "</XmlDS>";
        System.IO.StringReader xmlsr = new System.IO.StringReader(xmlData);
        ds.ReadXml(xmlsr, XmlReadMode.InferSchema);
        return ds;
    }
}//eof-class

DataSet dataSet = new DataSet();
DataTable dataTable = new DataTable("table1");
dataTable.Columns.Add("col1", typeof(string));
dataSet.Tables.Add(dataTable);

string xmlData = "<XmlDS><table1><col1>Value1</col1></table1>";
xmlData += "<table1><col1>Value2</col1></table1></XmlDS>";

System.IO.StringReader xmlSR = new System.IO.StringReader(xmlData);

dataSet.ReadXml(xmlSR, XmlReadMode.IgnoreSchema);

49) what is XDR?

10-Apr-07

what is XDR?

Getting Data from Oracle in asp.net

51) LINQ Notes

14-Nov-05

Linq

Credits: Paul Montgomery

To set a combo box ( or list box ) to all of the values in an enum, do the following.


this.ComboBox1.DataSource 
   = Enum.GetNames( typeof ( YourEnum ));

Then to get it back out.


YourEnum val 
   = (YourEnum) Enum.Parse(typeof(YourEnum)
          ,comboBox1.SelectedItem.ToString());

HttpPostedFile postedFile		= Request.Files["fieldname"];
if (posterFile != null)
    fileUpload.SaveAs(filePath);

Read the full story for limitations and work arounds for file sizes greater than 4M.

When an internet explorer control is embedded in a power builder window, the internet explorer seem to loose session cookies for popups. Obviously this is not desirable for a reason. This drawback prevents from embedding fully functional web applications inside of a client server systems such as those built powerbuilder, delphi, or home grown.

While searching for the related material in google it might interest the reader to note the following key words in their order of narrowness/importance descending.

NewWindow2 powerbuilder
NewWindow2
184876
311282
IWebBrowser2
ie new window session cookies

http://www.websupergoo.com/helpupload50/source/2-tech_notes/3-web.config.htm

httpRuntime
maxRequestLength
executionTimeout
sessionstateTimeout
responseDeadLockInterval

60) Introductory asp.net

27-May-04

http://www.asp101.com/lessons/

Basic composition/structure of an aspx page

62) A C# property

12-Apr-04

A C# property


public class SimpleProperty 
{
   private int number = 0;
   public int MyNumber 
   {
   get {  return number; }
   set {  number = value;}
   } 
}
public class UsesSimpleProperty
{
   public static void Main()
   {
      SimpleProperty example = new SimpleProperty();
      example.MyNumber = 5;
      int anumber = example.MyNumber;
   }
}
Idea of a web page control in .net
To upper case it: ctrl-shift-u
To lower case it: crl-u
. Create a dummy xml
. use xsd.exe to create the .xsd file
. use Visual studio to tweak the XSD for a) cardinality and b) data types

Caveat: There may alternate ways to generate the complex types in the XSD than the default approach that XSD takes. Nevertheless it should work.

1. Convert date/times to strings
2. A listing of datetime formats

http://www.internet.com/icom_cgi/print/print.cgi?url=http://www.15seconds.com/issue/030623.htm

Working with DB2, from a .NET application developer's perspective, is just like working with any other relational database. One can find endless examples of how to perform databases tasks (from the mundane to the interesting) for Microsoft SQL Server and Oracle, but there is not as much similar documentation for accessing DB2 from Microsoft technologies, including .NET.

68) 15Seconds.com

21-Aug-03

http://www.15seconds.com/

1. .net resources
2. data access technologies
3. articles
Some ideas on how to deal with database nulls in the .net world
char[] sepString = new char[]{'1'};
string[] userIdList = customerIdList.Split(sepString);

http://www.yoda.arachsys.com/

This has nice section on static initializers and static constructors

array examples: Instantiating, type checking, string splitting
m_timer.Interval = Convert.ToInt32(m_interval) * 1000;
sample code for walking through a data set
Some notes on .net exceptions
Explains derivation in c#, calling base class etc.