SqlCommand command = new SqlCommand(”ReportMultiTruckGeneric”);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(”@startDate”, SqlDbType.DateTime).Value = ProcessStartDate;
command.Parameters.Add(”@endDate”, SqlDbType.DateTime).Value = ProcessEndDate;
StringBuilder sb = new StringBuilder();
sb.Append(”<Trucks>”);
foreach (DataRow row in trucks.Tables[0].Rows)
{
sb.AppendFormat(”<TruckId>{0}</TruckId>”, row["ID"].ToString());
}
sb.Append(”</Trucks>”);
command.Parameters.Add(”@trucks”, SqlDbType.Xml).Value = sb.ToString();
DataSet queryResult = DBHook.SendSQLSelectRequest(command, out ex);
==store procedure=============
ALTER procedure [dbo].[ReportMultiTruckGeneric]
@startDate datetime,
@endDate datetime,
@trucks xml
as
…
set @trucksCopy = @trucks
…
select Trucks.TruckId.value(’.’, ‘int’)
from @trucksCopy.nodes(’Trucks/TruckId’) as Trucks(TruckId)
<asp:BoundField DataField=”prodPrice” HeaderText=”Price” HtmlEncode=”False” DataFormatString=”{0:f0}” />
Or in TemplateField
<asp:TemplateField HeaderText=”Price”>
<ItemTemplate>
<%#Eval(“prodPrice”,”{0:f0}”)%>
</ItemTemplate>
</asp:TemplateField>
Ex: {0:f0} is integer, {0:f1} is decimal with 1 digit
1. In the Internet Explorer, “Tools” Menu, select “Internet Options”.
2. Switch to “Security” Tab.
3. Click on “Internet” (The Globe Icon. Its actually the default selected).
4. Click on “Custom Level” in the bottom.
5. Scroll down to find the “User Authentication” section.
6. Select “Automatic logon with current username and password”.
7. Click “Ok” twice to exit.
ref:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vsdebug.asp
1. code behide
string ComputeSeniorityLevel(TimeSpan ts)
{
int numberOfDaysOnTheJob = ts.Days;
if (numberOfDaysOnTheJob >= 0 && numberOfDaysOnTheJob <= 1000)
return “Newbie”;
else if (numberOfDaysOnTheJob > 1000 && numberOfDaysOnTheJob <= 4000)
return “Associate”;
else if (numberOfDaysOnTheJob >= 4000 && numberOfDaysOnTheJob <= 8000)
return “One of the Regulars”;
else
return “An Ol’ Fogey”;
}
2. html
<asp:GridView ID=”GridView1″ Runat=”server”
DataSourceID=”employeeDataSource” AutoGenerateColumns=”False”
[...]
1. VS 2005 – create new website with ASP.NET Ajax-Enabled Website , then create WebService.asmx
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
/// <summary>
/// Summary description for WebService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService] // <== [System.Web.Script.Services.ScriptService]
public class WebService : System.Web.Services.WebService {
public WebService () {
//Uncomment the following line if using designed components
//InitializeComponent();
}[WebMethod]
public string HelloWorld() [...]
Label ID=”LabelDescription”
runat=”server”
Text=’<%# System.Web.HttpUtility.HtmlEncode((string)Eval(”Description”)) %>’
A Permalink is a permanent link which points to a particular blog entry or forum entry. For example the permalink for this blog article is http://csharp-codesamples.com/2009/03/aspnet-permalinks-using-url-rewriting.
This does not mean that a physical page is created for each blog entry. Instead a single page shows the data for multiple blogs articles dynamically based on some query [...]
http://geekswithblogs.net/ranganh/archive/2009/10/01/fileupload-in-updatepanel-asp.net-like-gmail.aspx
This video compares the same application written twice, once with Dynamic Data and once without. In the process, you add DynamicControl objects to ListView and DetailsView controls.
http://msdn.microsoft.com/en-us/library/system.web.dynamicdata.dynamiccontrol.aspx
http://www.bestechvideos.com/2008/06/02/asp-net-dynamic-data-how-do-i-use-a-dynamiccontrol-in-listview-and-detailsview-controls
//Sorting List<> case Item is ListItem
//==============================================
List<ListItem> tempList = new List<ListItem>();
tempList.Insert(0, new ListItem(”————- Vehicle Reports 8″));
tempList.Insert(0, new ListItem(”————- Vehicle Reports 2″));
tempList.Insert(0, new ListItem(”————- Vehicle Reports 4″));
// sort asc
tempList.Sort(delegate(ListItem p1, ListItem p2) {
return p1.Text.CompareTo(p2.Text);
[...]