gridview1 properties
optionView=>
ShowViewCaption=true;
ViewCaption="xxxxx";
วันจันทร์ที่ 18 พฤษภาคม พ.ศ. 2563
วันอังคารที่ 5 พฤษภาคม พ.ศ. 2563
ตรวจสอบสถานะ Connection
var sqlCon= new SqlConnection(Properties.Settings.Default.sString);
var mySQLCon= new MySqlConnection(Properties.Settings.Default.dString);
sqlCon.Open();
mySQLCon.Open();
var temp = mySQLConn.State.ToString();
if (sqlCon.State==ConnectionState.Open && temp=="Open")
{
MessageBox.Show(@"Connection working.");
}
else
{
MessageBox.Show(@"Please check connection string");
}
grid cell allignment
gridView2.Columns[i].AppearanceCell.TextOptions.HAlignment = HorzAlignment.Center;
gridcontrol Column Header
ASPxGridView1.Columns[0].Caption = "Some Value";
จัดหัวตารางอยู่กึ่งกลาง
int ccount = gridView2.Columns.Count;
for (int i = 0; i <= ccount-1; i++)
{
gridView2.Columns[i].AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center;
gridView2.Columns[i].AppearanceHeader.Options.UseTextOptions = true;
}
ตรวจสอบ textbox คีย์ตัวเลข
if (txtpidsearch.TextLength > 0)
{
int parsedValue;
if (!int.TryParse(txtpidsearch.Text, out parsedValue))
{
MessageBox.Show("กรอกเฉพาะตัวเลข !!!");
return;
}
else
{}
}
else
{}
{
int parsedValue;
if (!int.TryParse(txtpidsearch.Text, out parsedValue))
{
MessageBox.Show("กรอกเฉพาะตัวเลข !!!");
return;
}
else
{}
}
else
{}
สมัครสมาชิก:
บทความ (Atom)