using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Collections;

public partial class _Default : System.Web.UI.Page
{
List _persons = new List();
protected void Page_Load(object sender, EventArgs e)
{
person person1 = new person();
person1.ID = 1;
person1.Name = "Kiran";
_persons.Add(person1);

person person2 = new person();
person2.ID = 2;
person2.Name = "Avtar";
_persons.Add(person2);

person person3 = new person();
person3.ID = 3;
person3.Name = "Chintan";
_persons.Add(person3);

person _obj= FindPersonOnID(2);
SortPersonOnName();
}
private person FindPersonOnID(int ID)
{
return _persons.Find(delegate(person _Obj) {return _Obj.ID == ID; });
}
private void SortPersonOnName()
{
_persons.Sort(delegate(person _Obj1, person _obj2) { return Comparer.Default.Compare(_Obj1.Name, _obj2.Name); });
}
}
public class person
{
private int _ID;
public int ID
{
get { return _ID; }
set { _ID = value; }
}

private string _Name;
public string Name
{
get { return _Name; }
set { _Name = value; }
}
}

Protected Sub DeleteSelectedProducts_Click(sender As Object, e As EventArgs) _
Handles DeleteSelectedProducts.Click

Dim atLeastOneRowDeleted As Boolean = False

' Iterate through the Products.Rows property
For Each row As GridViewRow In Products.Rows
' Access the CheckBox
Dim cb As CheckBox = row.FindControl("ProductSelector")
If cb IsNot Nothing AndAlso cb.Checked Then
' Delete row! (Well, not really...)
atLeastOneRowDeleted = True

' First, get the ProductID for the selected row
Dim productID As Integer = _
Convert.ToInt32(Products.DataKeys(row.RowIndex).Value)

' "Delete" the row
DeleteResults.Text &= String.Format( _
"This would have deleted ProductID {0}
", productID)

'... To actually delete the product, use ...
' Dim productAPI As New ProductsBLL
' productAPI.DeleteProduct(productID)
'............................................
End If
Next

' Show the Label if at least one row was deleted...
DeleteResults.Visible = atLeastOneRowDeleted
End Sub

< asp:button text="Submit" onclientclick="Page_ClientValidate('ValidationGroup'); return (Page_IsValid && confirm('Are you sure?'));" onclick="Button1_Click" runat="server" id="Button1">< /asp:button >

Sometimes it is handy to have a quick overview of all the assemblies that your C# program has loaded. Maybe because you are trying to debug a version conflict, or because you want to distribute your application and want to get an idea of its dependencies.

To find the loaded assemblies we first need to determine the current AppDomain (it is possible for your application to have more than one AppDomain, but in that case you have created the second one yourself). Each AppDomain keeps a list of Assemblies it is using and in the following example code we query it using the GetAssemblies() method.

using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
AppDomain MyDomain = AppDomain.CurrentDomain;
Assembly[] AssembliesLoaded = MyDomain.GetAssemblies();

foreach (Assembly MyAssembly in AssembliesLoaded)
{
Console.WriteLine("Loaded: {0}", MyAssembly.FullName);
}
Console.ReadLine();
}
}
}

hi friends if you get crystal report toolbar images in local but do not get on server do this steps


1. copy this folder "CrystalReportWebFormViewer3" to project directory from following path Copy C:\Inetpub\wwwroot\aspnet_client\system_web\2_0_50727
\CrystalReportWebFormViewer3

2. and add these two properties

< id="CrystalReportViewer1" runat="server" autodatabind="true" hascrystallogo="False" enabledatabaselogonprompt="False" enableparameterprompt="False" grouptreeimagesfolderurl="CrystalReportWebFormViewer3/images/tree/" toolbarimagesfolderurl="CrystalReportWebFormViewer3/images/toolbar/">

3. upload CrystalReportWebFormViewer3 folder also on server

  • Datagrid has built in paging sorting and editing capabilities which are not there with the other two controls.
  • Datalist has a property called repeat. Direction = vertical or horizontal.This is most useful in designing layouts.
  • A repeater is used when more intimate control over html generation is required.Repeater is the most customizable. It allows you to create structures like nested lists for example.
  • The Repeater repeats a chunk of HTML you write, it has the least functionality of the three of them. DataList is the next step up from a Repeater; accept you have very little control over the HTML that the control renders. DataList is the first of the three controls that allow you Repeat-Columns horizontally or vertically.
  • Datagrid is most restrictive as regards to customization followed by DataList and finally Repeater is the most customizable. However, instead of working on a row-by-row basis, you’re working on a column-by-column basis. DataGrid caters to sorting and has basic paging for your disposal. NOTE: DataList and DataGrid both render as HTML tables by default.
  • Out of the 3 controls, I use the Repeater the most due to its flexibility. Occasionally I like using a DataList because it allows me to easily list out my records in rows of three for instance.

Create two LinkButton
1>btnshowall
2>btninstock


protected void btnshowall_Click(object sender, EventArgs e)
{
btnshowall.Attributes["OnClick"] = "return false;";
btninstock.Attributes["OnClick"] = "return true;";

btnshowall.CssClass = "inactive-text";
btninstock.CssClass = "active-text";
}
protected void btninstock_Click(object sender, EventArgs e)
{
btninstock.Attributes["OnClick"] = "return false;";
btnshowall.Attributes["OnClick"] = "return true;";

btnshowall.CssClass = "active-text";
btninstock.CssClass = "inactive-text";
}


 

| Modified by Kiran Patel |