Thursday, June 25, 2009
Wednesday, June 24, 2009
Cambodia Mobile Phone Operators
Do you really know how many mobile phone operators are there live broadcasting their mobile network service in Cambodia? From the 90s until 2007, there were merely 3 widely known mobile operators in our country. With these two years times, we are able to extend our mobile network service from 3 companies up to 9 operators. It really is amazing now that there are so many investors start their business in such field. I am pretty sure that in this year, with the competitive market and the help of technologies, the call rate would be decreased and of course the subscribers would reach more than it is now. Everyone is at least holding one mobile number and one mobile phone. It is believe that in the next few year, the Telecommunication industry would grow rapidly which means Cambodia is looking up ahead to the advancement of the technologies, hopefully.
1. APPLIFONE CO. LTD. (StarCell)
Operator Name: APPLIFONE CO. LTD.
Prefix: 098, 086
Network Name: StarCell
Technology: GSM 1800
Network Status: Live October 2007
Web Site: http://www.star-cell.net/
2. Cambodia Advance Communications Co. Ltd (qb)
Operator Name: Cambodia Advance Communications Co. Ltd (CADCOMMS)
Prefix: 013, 083, 084
Network Name: CADCOMMS
Technology: 3G 2100
Network Status: Live December 2006
Web Site: http://www.qbmore.com/
3. Cambodia Shinawatra Co. Ltd (CamShin/MFone)
Operator Name: Cambodia Shinawatra Co. Ltd
Prefix: 011, 099, 085
Network Name: CAMBODIA SHINAWATRA
Technology: GSM 1800
Network Status: Live April 1998
Web Site: http://www.mfone.com.kh/
4. CamGSM (MOBITEL/CellCard)
Operator Name: CamGSM
Prefix: 012, 092, 017, 089
Network Name: MOBITEL
Technology: GSM 900
Network Status: Live November 1996
Web Site: http://www.cellcard.com.kh/
5. Latelz Co., Ltd (Smart)
Operator Name: Latelz Co., Ltd
Prefix: 010, 093
Network Name: Latelz Co.
Technology: GSM 1800
Network Status: Planned November 2008
Web Site: http://www.smart.com.kh/
6. Sotelco Ltd. (Beeline-KH)
Operator Name: Sotelco Ltd.
Prefix: 090
Network Name: Beeline-KH
Technology: GSM 900/1800
Network Status: Planned June 2009
Web Site: http://www.beeline.com.kh/
7. Telekom Malaysia International (Cambodia) Co. Ltd (hello)
Operator Name: Telekom Malaysia International (Cambodia) Co. Ltd
Prefix: 015, 016, 081
Network Name: helloTechnology: GSM 900
Network Status: Live April 1999Web Site: http://www.tmic.com.kh/
8. VIETTEL (CAMBODIA) PTE., LTD (Metfone)
Operator Name: VIETTEL (CAMBODIA) PTE., LTD
Prefix: 097
Network Name: Metfone
Technology: GSM 900/1800
Network Status: Live June 2008
Web Site: http://www.metfone.com.kh/
9. GT-TELL (Cambodia) Investment Company Ltd.
Operator Name: GT-TELL (Cambodia)
Prefix: 018
Network Name: ExCell
Technology: CDMA
Network Status: Live 2008
Web Site: http://www.excell.com.kh
Tuesday, June 23, 2009
http://profiles.zenzuu.com/profiles/swisszenzuu.htm
ZenZuu is a Social Network that helps you make money!ZenZuu is a next generation social networking platform that lets you create a profile similar to other ancient social networks, except our leading edge technology allows you to make money by signing up your friends and receive revenue sharing. Seize your opportunity to cash in on the trillion dollar internet economy of social networking and global commerce with ZenZuu. Sign-Up Now It's FREE!
String.Format – How to format string in asp.net c#
String.Format – a useful reference
The String.Format routine can be very powerful – especially with numerics & padding. Here are some examples which I find a handy reference.
int neg = -10;int pos = 10;
// C or c (Currency)String.Format(”{0:C4}”, pos); //”$10.0000″String.Format(”{0:C4}”, neg); //”($10.0000)”
// D or d (Decimal) – leading zerosString.Format(”{0:D4}”, pos); //”0010″String.Format(”{0:D4}”, neg); //”-0010″
// E or e (Exponential)String.Format(”{0:E4}”, pos); //”1.0000E+001″String.Format(”{0:E4}”, neg); //”-1.0000E+001″
// F or f (Fixed-point)String.Format(”{0:F4}”, pos); //”10.0000″String.Format(”{0:F4}”, neg); //”-10.0000″
// P or p (Percent)String.Format(”{0:P4}”, pos); //”1,000.0000%”String.Format(”{0:P4}”, neg); //”-1,000.0000%”
Reference:
http://blog.stevex.net/index.php/string-formatting-in-csharp/
http://cgaskell.wordpress.com/category/aspnet-c/
The String.Format routine can be very powerful – especially with numerics & padding. Here are some examples which I find a handy reference.
int neg = -10;int pos = 10;
// C or c (Currency)String.Format(”{0:C4}”, pos); //”$10.0000″String.Format(”{0:C4}”, neg); //”($10.0000)”
// D or d (Decimal) – leading zerosString.Format(”{0:D4}”, pos); //”0010″String.Format(”{0:D4}”, neg); //”-0010″
// E or e (Exponential)String.Format(”{0:E4}”, pos); //”1.0000E+001″String.Format(”{0:E4}”, neg); //”-1.0000E+001″
// F or f (Fixed-point)String.Format(”{0:F4}”, pos); //”10.0000″String.Format(”{0:F4}”, neg); //”-10.0000″
// P or p (Percent)String.Format(”{0:P4}”, pos); //”1,000.0000%”String.Format(”{0:P4}”, neg); //”-1,000.0000%”
Reference:
http://blog.stevex.net/index.php/string-formatting-in-csharp/
http://cgaskell.wordpress.com/category/aspnet-c/
http://ajax.net-tutorials.com/controls/timer-control/
Timer controls allow you to do postbacks at certain intervals. If used together with UpdatePanels, which is the most common approach, it allows for timed partial updates of your page, but it can be used for posting back the entire page as well. Here is a small example of using the Timer control. It simply updates a timestamp every 5 seconds.
http://ajax.net-tutorials.com/controls/timer-control/
http://ajax.net-tutorials.com/controls/timer-control/
Monday, June 22, 2009
MySQL Query Browser
This is the MySQL GUI Tools Bundle for 5.0. It includes the following products which are also supported for MySQL 5.1.
MySQL Administrator 1.2
MySQL Query Browser 1.2
MySQL Migration Toolkit 1.1
http://dev.mysql.com/downloads/gui-tools/5.0.html
MySQL Administrator 1.2
MySQL Query Browser 1.2
MySQL Migration Toolkit 1.1
http://dev.mysql.com/downloads/gui-tools/5.0.html
Saturday, June 20, 2009
Friday, June 19, 2009
Thursday, June 18, 2009
Wednesday, June 17, 2009
Tuesday, June 16, 2009
Fulbright Scholarship Program
https://apply.embark.com/student/fulbright/international/
www.iie.org/fulbright/apps
http://mongkol.wordpress.com/2007/02/26/481/
http://cambodia.usembassy.gov/fulbright_program.html
www.iie.org/fulbright/apps
http://mongkol.wordpress.com/2007/02/26/481/
http://cambodia.usembassy.gov/fulbright_program.html
Monday, June 15, 2009
Working with DataGridView + VB.NET
1. How to assign to gridview
With DataGridView1.Rows(0)
.Cells(0).Value = "E001"
.Cells(1).Value = "Thy Yuthear"
.Cells(2).Value = "Male"
End With
2. How to retreive value from GridView when select
Event: DataGridView1_CellMouseClick
MsgBox(DataGridView1.Rows(e.RowIndex).Cells(0).Value.ToString())
With DataGridView1.Rows(0)
.Cells(0).Value = "E001"
.Cells(1).Value = "Thy Yuthear"
.Cells(2).Value = "Male"
End With
2. How to retreive value from GridView when select
Event: DataGridView1_CellMouseClick
MsgBox(DataGridView1.Rows(e.RowIndex).Cells(0).Value.ToString())
how to clear controls in asp.net c#
1. how to clear controls in asp.net c#
private void ClearControls(Control parent)
{
foreach (Control _ChildControl in parent.Controls)
{
if ((_ChildControl.Controls.Count > 0))
{
ClearControls(_ChildControl);
}
else
{
if (_ChildControl is TextBox)
{
((TextBox)_ChildControl).Text = string.Empty;
}
else
if (_ChildControl is CheckBox)
{
((CheckBox)_ChildControl).Checked = false;
}
}
}
}
At Calling Statement send reference of page “this”. For example, ClearControls(this)
2. Ways to Clear Controls values in the Page
1. Creating method that would loop through the page controls and clear its values accordingly like:
private void ClearControls()
{
foreach (Control c in Page.Controls)
{
if (c.GetType().ToString() == "System.Web.UI.WebControls.TextBox")
{
TextBox tb = (TextBox)c;
if (tb != null)
{
tb.Text = string.Empty;
}
}
if (c.GetType().ToString() == "System.Web.UI.WebControls.DropDownList")
{
DropDownList ddl = (DropDownList)c;
if (ddl != null)
{
ddl.ClearSelection();
}
}
}
2. Creating a generic Recursive FindControl method that would search all the Controls in the page and reset their values.
public static void ClearControls(Control Parent)
{
if (Parent is TextBox)
{ (Parent as TextBox).Text = string.Empty; }
else
{
foreach (Control c in Parent.Controls)
ClearControls(c);
}
}
//Then call the method like this
ClearControls(Page)
3. Using HTML Input type RESET Button
input type="reset" value="Reset form
4. Redirect to the same page using Response.Redirect method.
Response.Redirect("YourPage.aspx");
private void ClearControls(Control parent)
{
foreach (Control _ChildControl in parent.Controls)
{
if ((_ChildControl.Controls.Count > 0))
{
ClearControls(_ChildControl);
}
else
{
if (_ChildControl is TextBox)
{
((TextBox)_ChildControl).Text = string.Empty;
}
else
if (_ChildControl is CheckBox)
{
((CheckBox)_ChildControl).Checked = false;
}
}
}
}
At Calling Statement send reference of page “this”. For example, ClearControls(this)
2. Ways to Clear Controls values in the Page
1. Creating method that would loop through the page controls and clear its values accordingly like:
private void ClearControls()
{
foreach (Control c in Page.Controls)
{
if (c.GetType().ToString() == "System.Web.UI.WebControls.TextBox")
{
TextBox tb = (TextBox)c;
if (tb != null)
{
tb.Text = string.Empty;
}
}
if (c.GetType().ToString() == "System.Web.UI.WebControls.DropDownList")
{
DropDownList ddl = (DropDownList)c;
if (ddl != null)
{
ddl.ClearSelection();
}
}
}
2. Creating a generic Recursive FindControl method that would search all the Controls in the page and reset their values.
public static void ClearControls(Control Parent)
{
if (Parent is TextBox)
{ (Parent as TextBox).Text = string.Empty; }
else
{
foreach (Control c in Parent.Controls)
ClearControls(c);
}
}
//Then call the method like this
ClearControls(Page)
3. Using HTML Input type RESET Button
input type="reset" value="Reset form
4. Redirect to the same page using Response.Redirect method.
Response.Redirect("YourPage.aspx");
Saturday, June 13, 2009
Friday, June 12, 2009
Search engine friendly URLs using ASP.NET (C#.NET)
http://www.stardeveloper.com/articles/display.html?article=2004022801&page=1
http://www.codetoad.com/asp.net_ma_searchenginefriendly.asp
http://www.winnershtriangle.com/w/ASPNetHelp_BuildingASPNetSearchEngine.asp
http://www.codetoad.com/asp.net_ma_searchenginefriendly.asp
http://www.winnershtriangle.com/w/ASPNetHelp_BuildingASPNetSearchEngine.asp
How To Read File Information With ASP.NET?
If you try to create file manager in ASP.NET or simply you want to know some specific attribute of some file, you can use FileInfo class to get all needed file information. Bellow is simple code example about how to use FileInfo class. You can copy/paste this code to see how it works. Just replace "products.xml" with needed file.
[ C# ]
// To read file information, we need System.IO namespace
using System.IO;
public partial class DefaultCS : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
string FilePath = Server.MapPath("products.xml");
FileInfo MyFileInfo = new FileInfo(FilePath);
string FileInformation = "File information:
";
// Check if file exists
if(MyFileInfo.Exists)
{
// File exists, take data about it
FileInformation = "File Name: " + MyFileInfo.Name + "
";
FileInformation += "Directory: " + MyFileInfo.DirectoryName + "
";
FileInformation += "Full path: " + MyFileInfo.FullName + "
";
FileInformation += "Time Created: " + MyFileInfo.CreationTime + "
";
FileInformation += "Time Modified: " + MyFileInfo.LastWriteTime + "
";
FileInformation += "Last Access Time: " + MyFileInfo.LastAccessTime + "
";
// Gets file size in bytes
FileInformation += "File Size: " + MyFileInfo.Length + "
";
// Gets extension part of file name
FileInformation += "File Extension: " + MyFileInfo.Extension;
}
else
{
// File not exists, inform a user about it
FileInformation = "There is no file on " + FilePath + ".";
}
Response.Write(FileInformation);
}
}
[ VB.NET ]
' To read file information, we need System.IO namespace
Imports System.IO
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim FilePath As String = Server.MapPath("products.xml")
Dim MyFileInfo As FileInfo = New FileInfo(FilePath)
Dim FileInformation As String = "File information:
"
' Check if file exists
If (MyFileInfo.Exists) Then
' File exists, take data about it
FileInformation = "File Name: " & MyFileInfo.Name & "
"
FileInformation &= "Directory: " & MyFileInfo.DirectoryName & "
"
FileInformation &= "Full path: " & MyFileInfo.FullName & "
"
FileInformation &= "Time Created: " & MyFileInfo.CreationTime & "
"
FileInformation &= "Time Modified: " & MyFileInfo.LastWriteTime & "
"
FileInformation &= "Last Access Time: " & MyFileInfo.LastAccessTime & "
"
' Gets file size in bytes
FileInformation &= "File Size: " & MyFileInfo.Length & "
"
' Gets extension part of file name
FileInformation &= "File Extension: " & MyFileInfo.Extension
Else
' File not exists, inform a user about it
FileInformation = "There is no file on " & FilePath & "."
End If
Response.Write(FileInformation)
End Sub
End Class
http://www.beansoftware.com/ASP.NET-FAQ/Read-File-Information.aspx
--------------------------------------------------------------------------
Get FileInfo: file size, file attribute list
using System;
using System.IO;
class MainClass
{
public static void Main(string[] args)
{
FileInfo file = new FileInfo("c:\\test.txt");
Console.WriteLine("Checking file: " + file.Name);
Console.WriteLine("File exists: " + file.Exists.ToString());
if (file.Exists)
{
Console.Write("File size (bytes): ");
Console.WriteLine(file.Length.ToString());
Console.Write("File attribute list: ");
Console.WriteLine(file.Attributes.ToString());
}
}
}
[ C# ]
// To read file information, we need System.IO namespace
using System.IO;
public partial class DefaultCS : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
string FilePath = Server.MapPath("products.xml");
FileInfo MyFileInfo = new FileInfo(FilePath);
string FileInformation = "File information:
";
// Check if file exists
if(MyFileInfo.Exists)
{
// File exists, take data about it
FileInformation = "File Name: " + MyFileInfo.Name + "
";
FileInformation += "Directory: " + MyFileInfo.DirectoryName + "
";
FileInformation += "Full path: " + MyFileInfo.FullName + "
";
FileInformation += "Time Created: " + MyFileInfo.CreationTime + "
";
FileInformation += "Time Modified: " + MyFileInfo.LastWriteTime + "
";
FileInformation += "Last Access Time: " + MyFileInfo.LastAccessTime + "
";
// Gets file size in bytes
FileInformation += "File Size: " + MyFileInfo.Length + "
";
// Gets extension part of file name
FileInformation += "File Extension: " + MyFileInfo.Extension;
}
else
{
// File not exists, inform a user about it
FileInformation = "There is no file on " + FilePath + ".";
}
Response.Write(FileInformation);
}
}
[ VB.NET ]
' To read file information, we need System.IO namespace
Imports System.IO
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim FilePath As String = Server.MapPath("products.xml")
Dim MyFileInfo As FileInfo = New FileInfo(FilePath)
Dim FileInformation As String = "File information:
"
' Check if file exists
If (MyFileInfo.Exists) Then
' File exists, take data about it
FileInformation = "File Name: " & MyFileInfo.Name & "
"
FileInformation &= "Directory: " & MyFileInfo.DirectoryName & "
"
FileInformation &= "Full path: " & MyFileInfo.FullName & "
"
FileInformation &= "Time Created: " & MyFileInfo.CreationTime & "
"
FileInformation &= "Time Modified: " & MyFileInfo.LastWriteTime & "
"
FileInformation &= "Last Access Time: " & MyFileInfo.LastAccessTime & "
"
' Gets file size in bytes
FileInformation &= "File Size: " & MyFileInfo.Length & "
"
' Gets extension part of file name
FileInformation &= "File Extension: " & MyFileInfo.Extension
Else
' File not exists, inform a user about it
FileInformation = "There is no file on " & FilePath & "."
End If
Response.Write(FileInformation)
End Sub
End Class
http://www.beansoftware.com/ASP.NET-FAQ/Read-File-Information.aspx
--------------------------------------------------------------------------
Get FileInfo: file size, file attribute list
using System;
using System.IO;
class MainClass
{
public static void Main(string[] args)
{
FileInfo file = new FileInfo("c:\\test.txt");
Console.WriteLine("Checking file: " + file.Name);
Console.WriteLine("File exists: " + file.Exists.ToString());
if (file.Exists)
{
Console.Write("File size (bytes): ");
Console.WriteLine(file.Length.ToString());
Console.Write("File attribute list: ");
Console.WriteLine(file.Attributes.ToString());
}
}
}
File Upload with ASP.NET C#
http://shawpnendu.blogspot.com/2009/05/file-upload-with-aspnet-c.html
http://www.dotnetspider.com/resources/26294-Limiting-FileUpload-Size-ASP-NET.aspx
http://www.dotnetspider.com/resources/26294-Limiting-FileUpload-Size-ASP-NET.aspx
Thursday, June 11, 2009
Loading Images Asynchronously Inside an ASP.NET GridView
http://www.dotnetcurry.com/ShowArticle.aspx?ID=193&AspxAutoDetectCookieSupport=1
Binary Image Data in MSSQL
http://www.primaryobjects.com/CMS/Article59.aspx
http://riteshshah.wordpress.com/2009/03/07/image-store-in-sql-server-2005-database-and-retrieve-it-in-aspnet-application-with-c/
http://www.dotnet-friends.com/Articles/ASP/ARTinASP45cf7ec8-f523-4b10-ac52-06676d7034d1.aspx
http://www.beansoftware.com/ASP.NET-Tutorials/Binary-Files-To-Database.aspx
http://riteshshah.wordpress.com/2009/03/07/image-store-in-sql-server-2005-database-and-retrieve-it-in-aspnet-application-with-c/
http://www.dotnet-friends.com/Articles/ASP/ARTinASP45cf7ec8-f523-4b10-ac52-06676d7034d1.aspx
http://www.beansoftware.com/ASP.NET-Tutorials/Binary-Files-To-Database.aspx
ASP.NET C#
1. Read data from DataReader
Syntax: 1
DBAccess db = new DBAccess();
IDataReader dr;
dr = db.ExecuteReader("select * from tblQuestionAnswer where QId='" + Request.QueryString["QuestionId"].ToString() + "'");
if (dr.Read())
{
this.txtQuestionNumber.Text = dr["QuestionNumber"].ToString();
this.txtQuestionName.Text= (string)dr["QuestionName"];
this.txtAnswerName.Text =(string)dr["AnswerName"];
this.txtAnswerNumber.Text=dr["AnswerNumber"].ToString();
this.chkIsActive.Checked =(bool)dr["IsActivate"];
//this.chkIsActive.Checked = dr.GetBoolean(dr.GetOrdinal("IsActivate"));
}
dr.Close();
Syntax: 2
DBAccess db = new DBAccess();
IDataReader dr;
dr = db.ExecuteReader("select * from tblAnswer where AnswerId='" + Request.QueryString["AnswerId"].ToString() + "'");
if (dr.Read()){
string str = dr.GetInt32(dr.GetOrdinal("QuestionId")).ToStrin();
this.ddlQuestion.ClearSelection();
this.ddlQuestion.Items.FindByValue(str).Selected = true;
this.txtAnswerKh.Text = dr.GetString(dr.GetOrdinal("AnswerNameKh"));
if (dr.GetString(dr.GetOrdinal("AnswerNameEng"))==null){
this.txtAnswerEng.Text = string.Empty;
}else{
this.txtAnswerEng.Text = dr.GetString(dr.GetOrdinal("AnswerNameEng"));
} this.chkCorrectAnswer.Checked = dr.GetBoolean(dr.GetOrdinal"CorrectAnswer"));
this.chkIsActive.Checked = dr.GetBoolean(dr.GetOrdinal("IsActivate"));
}
dr.Close();
2. Select value from dropdownlist by criteria
if (dr.Read()){
string str = dr.GetInt32(dr.GetOrdinal("QuestionId")).ToStrin();
this.ddlQuestion.ClearSelection();
---
}
dr.Close();
3. How to bind data to dropdownlist
DBAccess db = new DBAccess();
DataSet ds = new DataSet();
ds = db.ExecuteDataSet("SELECT QuestionId, QuestionNameEng, QuestionNameKh, CASE WHEN QuestionNameEng IS NULL THEN QuestionNameKh WHEN QuestionNameEng IS NULL THEN QuestionNameEng ELSE QuestionNameEng + space(3) + QuestionNameKh END AS Display FROM dbo.tblQuestion order by QuestionId");
this.ddlQuestion.DataSource = ds.Tables[0];
this.ddlQuestion.DataTextField = "Display";
this.ddlQuestion.DataValueField = "QuestionId";
this.DataBind();
Code behind:
protected void gv_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
string strSID = e.CommandArgument.ToString();
string strSQL = "DELETE FROM [dbo].[tblAnswer] WHERE AnswerId=" + strSID;
DBAccess dbDelete = new DBAccess();
dbDelete.ExecuteNonQuery(strSQL);
Response.Redirect("Answer.aspx?Accessmode=delete");
}
}
protected void gv_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gv.PageIndex = e.NewPageIndex;
bindGridView();
}
Syntax: 1
DBAccess db = new DBAccess();
IDataReader dr;
dr = db.ExecuteReader("select * from tblQuestionAnswer where QId='" + Request.QueryString["QuestionId"].ToString() + "'");
if (dr.Read())
{
this.txtQuestionNumber.Text = dr["QuestionNumber"].ToString();
this.txtQuestionName.Text= (string)dr["QuestionName"];
this.txtAnswerName.Text =(string)dr["AnswerName"];
this.txtAnswerNumber.Text=dr["AnswerNumber"].ToString();
this.chkIsActive.Checked =(bool)dr["IsActivate"];
//this.chkIsActive.Checked = dr.GetBoolean(dr.GetOrdinal("IsActivate"));
}
dr.Close();
Syntax: 2
DBAccess db = new DBAccess();
IDataReader dr;
dr = db.ExecuteReader("select * from tblAnswer where AnswerId='" + Request.QueryString["AnswerId"].ToString() + "'");
if (dr.Read()){
string str = dr.GetInt32(dr.GetOrdinal("QuestionId")).ToStrin();
this.ddlQuestion.ClearSelection();
this.ddlQuestion.Items.FindByValue(str).Selected = true;
this.txtAnswerKh.Text = dr.GetString(dr.GetOrdinal("AnswerNameKh"));
if (dr.GetString(dr.GetOrdinal("AnswerNameEng"))==null){
this.txtAnswerEng.Text = string.Empty;
}else{
this.txtAnswerEng.Text = dr.GetString(dr.GetOrdinal("AnswerNameEng"));
} this.chkCorrectAnswer.Checked = dr.GetBoolean(dr.GetOrdinal"CorrectAnswer"));
this.chkIsActive.Checked = dr.GetBoolean(dr.GetOrdinal("IsActivate"));
}
dr.Close();
2. Select value from dropdownlist by criteria
if (dr.Read()){
string str = dr.GetInt32(dr.GetOrdinal("QuestionId")).ToStrin();
this.ddlQuestion.ClearSelection();
---
}
dr.Close();
3. How to bind data to dropdownlist
DBAccess db = new DBAccess();
DataSet ds = new DataSet();
ds = db.ExecuteDataSet("SELECT QuestionId, QuestionNameEng, QuestionNameKh, CASE WHEN QuestionNameEng IS NULL THEN QuestionNameKh WHEN QuestionNameEng IS NULL THEN QuestionNameEng ELSE QuestionNameEng + space(3) + QuestionNameKh END AS Display FROM dbo.tblQuestion order by QuestionId");
this.ddlQuestion.DataSource = ds.Tables[0];
this.ddlQuestion.DataTextField = "Display";
this.ddlQuestion.DataValueField = "QuestionId";
this.DataBind();
Code behind:
protected void gv_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
string strSID = e.CommandArgument.ToString();
string strSQL = "DELETE FROM [dbo].[tblAnswer] WHERE AnswerId=" + strSID;
DBAccess dbDelete = new DBAccess();
dbDelete.ExecuteNonQuery(strSQL);
Response.Redirect("Answer.aspx?Accessmode=delete");
}
}
protected void gv_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gv.PageIndex = e.NewPageIndex;
bindGridView();
}
Wednesday, June 10, 2009
HOW TO: Create an RSS Feed Programmatically
RSS stands for "Really Simple Syndication," and it's all the rage. The idea is pretty simple. Output some XML to the Web that content aggregators and other sites can consume and display. If you have a normal routine of sites you visit with frequent content updates (news, blogs, whatever), and each site has an RSS feed, you can at a glance see what's new at all of these sites with an aggregator.
I won't go into detail about how to use these feeds, but there's a great little piece over at LockerGnome that tells you all about it. You'll also find links to aggregators, and if you find one you like, you'll find yourself subscribing to feeds all over the place.
The benefit to you is that you might just attract visits to your site from people who might not otherwise go there because they can see what's new at many sites without having to wade through all of their bookmarks. And hey, if you're putting out some kind of list of headlines on your site, you probably already have the data access code written. Now you just need to present it as XML.
http://www.uberasp.net/getarticle.aspx?id=17
I won't go into detail about how to use these feeds, but there's a great little piece over at LockerGnome that tells you all about it. You'll also find links to aggregators, and if you find one you like, you'll find yourself subscribing to feeds all over the place.
The benefit to you is that you might just attract visits to your site from people who might not otherwise go there because they can see what's new at many sites without having to wade through all of their bookmarks. And hey, if you're putting out some kind of list of headlines on your site, you probably already have the data access code written. Now you just need to present it as XML.
http://www.uberasp.net/getarticle.aspx?id=17
ConnectionString with VB.NET
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Web
Dim myConString As String = ConfigurationManager.ConnectionStrings("MyDatabaseConnectionStringIdentifier").ConnectionString
Dim Path As String = "C:\DBInfo.xml"
Dim doc As System.Xml.XmlDocument
Dim nodeList As System.Xml.XmlNodeList
Dim strConn As String
Dim objSqlConn As SqlConnection
doc = New XmlDocument()
doc.Load(Path)
node = doc.SelectSingleNode("Database/DB")
strConn = node.FirstChild.FirstChild.Value
Imports System.Configuration
Imports System.Web
Dim myConString As String = ConfigurationManager.ConnectionStrings("MyDatabaseConnectionStringIdentifier").ConnectionString
Dim Path As String = "C:\DBInfo.xml"
Dim doc As System.Xml.XmlDocument
Dim nodeList As System.Xml.XmlNodeList
Dim strConn As String
Dim objSqlConn As SqlConnection
doc = New XmlDocument()
doc.Load(Path)
node = doc.SelectSingleNode("Database/DB")
strConn = node.FirstChild.FirstChild.Value
http://www.daypilot.org/scheduler-tutorial.html
Scheduler Tutorial: Database & Event Moving (C#, VB.NET)
HOW TO: Implement CAPTCHA with ASP.NET
http://www.worldofasp.net/tut/captcha/Implement_captcha_control_library_for_ASPNET_185.aspx
http://www.captcha.net/
http://weblogs.asp.net/
http://www.captcha.net/
http://weblogs.asp.net/
Tuesday, June 9, 2009
http://www.online-cash-advance.com/
Free Web Page Hit Counters
This page provides a large selection of website hit counters that are provided by Online-Cash-Advance.com. Our hit counters are entirely FREE. The only thing we ask is that if you use one of our hit counters that you add a link back to our website. However, you are not required to link back to Online-Cash-Advance.com if you don't want to - your hit counter will still be free. However, if you support free commerce and the online finance industry then we invite you to link to our website to show your support.
This page provides a large selection of website hit counters that are provided by Online-Cash-Advance.com. Our hit counters are entirely FREE. The only thing we ask is that if you use one of our hit counters that you add a link back to our website. However, you are not required to link back to Online-Cash-Advance.com if you don't want to - your hit counter will still be free. However, if you support free commerce and the online finance industry then we invite you to link to our website to show your support.
Saturday, June 6, 2009
Get boolean value from database for ASP.NET C#
public bool getActiveUser(string UserName,string Password) {
DBAccess cmd = new DBAccess();
string sql = "select isactivate from tblusers where username='" + clsUtilities.sqlStr(this.UserName.Text) + "' and [password]='" + clsUtilities.sqlStr(this.Password.Text) + "'";
bool i = (bool) cmd.ExecuteScalar(sql);
if (i==true)
{
return true;
}
else
{
return false;
}
}
DBAccess cmd = new DBAccess();
string sql = "select isactivate from tblusers where username='" + clsUtilities.sqlStr(this.UserName.Text) + "' and [password]='" + clsUtilities.sqlStr(this.Password.Text) + "'";
bool i = (bool) cmd.ExecuteScalar(sql);
if (i==true)
{
return true;
}
else
{
return false;
}
}
How to convert string in session to upper letter
txtDoctorName.Text = Session["doctorName"].toString().Substring(5).toUpper();
Friday, June 5, 2009
Thursday, June 4, 2009
string.IsNullOrEmpty Method in C#
http://dotnetperls.com/Content/IsNullOrEmpty-Samples.aspx
http://www.dotnetspider.com/resources/4540-Checking-Null-Or-Empty.aspx
How to check for null or empty string:
string str = "some value";
if(string.IsNullOrEmpty(str))
{
//do something
}
http://www.dotnetspider.com/resources/4540-Checking-Null-Or-Empty.aspx
How to check for null or empty string:
string str = "some value";
if(string.IsNullOrEmpty(str))
{
//do something
}
Movie Download Free with Torrent
The following websites for downloading with torrent:
http://www.ahashare.com/
http://www.torrentroom.com/
http://www.ahashare.com/
http://www.torrentroom.com/
Tuesday, June 2, 2009
Monday, June 1, 2009
Add English and Khmer value to ComboBox
protected void Page_Load(object sender, EventArgs e){
if (!IsPostBack) {
//--- Add TrainerId, TrainerName to Combox
addTrainer();
}
}
---------------------------------------
void addTrainer(){
DBAccess db = new DBAccess();
DataSet ds = new DataSet();
ds = db.ExecuteDataSet("SELECT TrainerID, TrainerNameEng, TrainerNameKh, CASE WHEN TrainerNameEng IS NULL THEN TrainerNameKh WHEN TrainerNameKh IS NULL THEN TrainerNameEng ELSE TrainerNameEng + space(3) + TrainerNameKh END AS Display FROM dbo.tblTrainer");
this.ddlTrainerName.DataSource = ds.Tables[0];
this.ddlTrainerName.DataTextField = "Display";
this.ddlTrainerName.DataValueField = "TrainerID";
this.DataBind();
}
if (!IsPostBack) {
//--- Add TrainerId, TrainerName to Combox
addTrainer();
}
}
---------------------------------------
void addTrainer(){
DBAccess db = new DBAccess();
DataSet ds = new DataSet();
ds = db.ExecuteDataSet("SELECT TrainerID, TrainerNameEng, TrainerNameKh, CASE WHEN TrainerNameEng IS NULL THEN TrainerNameKh WHEN TrainerNameKh IS NULL THEN TrainerNameEng ELSE TrainerNameEng + space(3) + TrainerNameKh END AS Display FROM dbo.tblTrainer");
this.ddlTrainerName.DataSource = ds.Tables[0];
this.ddlTrainerName.DataTextField = "Display";
this.ddlTrainerName.DataValueField = "TrainerID";
this.DataBind();
}
Subscribe to:
Posts (Atom)