|
|
|
รบกวนหน่อยนะครับ อยากให้มันได้ผลรัน ตามภาพอ่ะครับ ต้องเพิ่มตรงไหนครับ ขอบคุณครับ |
|
|
|
|
|
|
|
นี่ code ครับ
นี่ผลรันครับ อยากให้ตรง Edit ขึ้น แบบนี้ครับ รบกวนหน่อยนะครับ
Code (C#)
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FrmAppList.ascx.cs" Inherits="AdvanceAppointment.MyAppList" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="MySql.Data.MySqlClient" %>
<script runat="server">
MySqlConnection objConn;
MySqlCommand objCmd;
string dateclick;
void Page_Load(object sender,EventArgs e)
{
String strConnString;
strConnString = "Server=localhost;User Pooling=false";
objConn = new MySqlConnection(strConnString);
objConn.Open();
}
void Calendar1_SelectionChanged(object sender, EventArgs e)
{
this.txtdateclick.Text = "" + this.Calendar1.SelectedDate.ToShortDateString();
dateclick = this.txtdateclick.Text;
BindData();
}
void BindData()
{
String strSQL;
strSQL = "SELECT * FROM user WHERE (DateBook like '%" + dateclick + "%')";
MySqlDataReader dtReader;
objCmd = new MySqlCommand(strSQL, objConn);
dtReader = objCmd.ExecuteReader();
//*** BindData to GridView ***//
MainGridView.DataSource = dtReader;
MainGridView.DataBind();
dtReader.Close();
dtReader = null;
}
void Page_UnLoad()
{
objConn.Close();
objConn = null;
}
void MainGridView_RowDataBound(Object s, GridViewRowEventArgs e)
{
//*** CustomerID ***//
Label lblHNID = (Label)(e.Row.FindControl("lblHNID"));
if (lblHNID != null)
{
lblHNID.Text = (string)DataBinder.Eval(e.Row.DataItem, "HNID");
}
//*** FName ***//
Label lblFName = (Label)(e.Row.FindControl("lblFName"));
if (lblFName != null)
{
lblFName.Text = (string)DataBinder.Eval(e.Row.DataItem, "FName");
}
//*** LName ***//
Label lblLName = (Label)(e.Row.FindControl("lblLName"));
if (lblLName != null)
{
lblLName.Text = (string)DataBinder.Eval(e.Row.DataItem, "LName");
}
//*** Telephone ***//
Label lblTel = (Label)(e.Row.FindControl("lblTel"));
if (lblTel != null)
{
lblTel.Text = (string)DataBinder.Eval(e.Row.DataItem, "Tel");
}
//*** Date ***//
Label lblDate = (Label)(e.Row.FindControl("lblDate"));
if (lblDate != null)
{
lblDate.Text = DataBinder.Eval(e.Row.DataItem, "Date").ToString();
}
//*** Program ***//
Label lblProgram = (Label)(e.Row.FindControl("lblProgram"));
if (lblProgram != null)
{
lblProgram.Text = DataBinder.Eval(e.Row.DataItem, "Program").ToString();
}
//*** Additional ***//
Label lblAdditional = (Label)(e.Row.FindControl("lblAdditional"));
if (lblAdditional != null)
{
lblAdditional.Text = DataBinder.Eval(e.Row.DataItem, "Additional").ToString();
}
//*** Comment ***//
Label lblComment = (Label)(e.Row.FindControl("lblComment"));
if (lblComment != null)
{
lblComment.Text = DataBinder.Eval(e.Row.DataItem, "Comment").ToString();
}
//*** Status ***//
Label lblStatus = (Label)(e.Row.FindControl("lblStatus"));
if (lblStatus != null)
{
lblStatus.Text = DataBinder.Eval(e.Row.DataItem, "Status").ToString();
}
//*** StaffName ***//
Label lblStaffName = (Label)(e.Row.FindControl("lblStaffName"));
if (lblStaffName != null)
{
lblStaffName.Text = DataBinder.Eval(e.Row.DataItem, "StaffName").ToString();
}
}
</script>
<asp:Panel ID="Panel1" runat="server">
<asp:Menu ID="Menu1" runat="server" BackColor="#F7F6F3"
DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em"
ForeColor="#7C6F57" StaticSubMenuIndent="10px">
<DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<DynamicMenuStyle BackColor="#F7F6F3" />
<DynamicSelectedStyle BackColor="#5D7B9D" />
<Items>
<asp:MenuItem Text="Menu" Value="Menu">
<asp:MenuItem Text="Appointment" Value="Appointment">
<asp:MenuItem Text="With ultrasound" Value="With ultrasound"></asp:MenuItem>
<asp:MenuItem Text="With out untrasound" Value="With out untrasound">
</asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Search" Value="Search"></asp:MenuItem>
<asp:MenuItem Text="Print" Value="Print"></asp:MenuItem>
<asp:MenuItem Text="Exit" Value="Exit"></asp:MenuItem>
</asp:MenuItem>
</Items>
<StaticHoverStyle BackColor="#7C6F57" ForeColor="White" />
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<StaticSelectedStyle BackColor="#5D7B9D" />
</asp:Menu>
</asp:Panel>
<asp:Panel ID="Panel2" runat="server" Height="100%">
<table border="0" style="height: 124px; width: 585px">
<tbody>
<tr>
<td class="style2">
<asp:Calendar ID="Calendar1" runat="server"
onselectionchanged="Calendar1_SelectionChanged"></asp:Calendar>
</td>
<td>
<asp:TextBox ID="txtdateclick" runat="server" Width="150px"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label1" runat="server" Text="Comment:"></asp:Label>
<br />
<asp:TextBox ID="TextBox2" runat="server" Height="100px" Width="300px"></asp:TextBox>
</td>
</tr>
</tbody>
</table>
<br />
<asp:Label ID="Label35" runat="server" Text="Program with Ultrasound"></asp:Label>
:<br />
<asp:Panel ID="Panel3" runat="server" Height="100%" Width="100%">
<asp:GridView ID="MainGridView" runat="server" AutoGenerateColumns="False"
onRowDataBound="MainGridView_RowDataBound" Width="875px"
ShowFooter="True"
DataKeyField="HNID"
OnCancelCommand="MainGridView_CancelCommand"
OnDeleteCommand="MainGridView_DeleteCommand"
OnEditCommand="MainGridView_EditCommand"
OnItemCommand="MainGridView_ItemCommand"
OnUpdateCommand="MainGridView_UpdateCommand">
<Columns>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<%# Container.DataItemIndex + 1 %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="HNID">
<ItemTemplate>
<asp:Label ID="lblHNID" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="FName">
<ItemTemplate>
<asp:Label ID="lblFName" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="LName">
<ItemTemplate>
<asp:Label ID="lblLName" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Tel">
<ItemTemplate>
<asp:Label ID="lblTel" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Date">
<ItemTemplate>
<asp:Label ID="lblDate" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Program">
<ItemTemplate>
<asp:Label ID="lblProgram" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Additional">
<ItemTemplate>
<asp:Label ID="lblAdditional" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Comment">
<ItemTemplate>
<asp:Label ID="lblComment" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Status">
<ItemTemplate>
<asp:Label ID="lblStatus" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="StaffName">
<ItemTemplate>
<asp:Label ID="lblStaffName" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Edit">
<EditItemTemplate>
<asp:ButtonColumn Text="Delete" runat="server" CommandName="Delete" HeaderText="Delete">
</asp:ButtonColumn>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
Stand by :<br />
<table border="1">
<tbody>
<tr>
<td>
<asp:Label ID="Label36" runat="server" Text="HNID"></asp:Label>
</td>
<td>
<asp:Label ID="Label37" runat="server" Text="FName"></asp:Label>
</td>
<td>
<asp:Label ID="Label38" runat="server" Text="LName"></asp:Label>
</td>
<td>
<asp:Label ID="Label39" runat="server" Text="Tel"></asp:Label>
</td>
<td>
<asp:Label ID="Label40" runat="server" Text="Date"></asp:Label>
</td>
<td>
<asp:Label ID="Label41" runat="server" Text="Program"></asp:Label>
</td>
<td>
<asp:Label ID="Label42" runat="server" Text="Additional"></asp:Label>
</td>
<td>
<asp:Label ID="Label43" runat="server" Text="Comment"></asp:Label>
</td>
<td>
<asp:Label ID="Label44" runat="server" Text="StaffName"></asp:Label>
</td>
<td>
<asp:Label ID="Label45" runat="server" Text="Status"></asp:Label>
</td>
<td>
<asp:Label ID="Label46" runat="server" Text="Operation"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label47" runat="server" Text="HNID"></asp:Label>
</td>
<td>
<asp:Label ID="Label48" runat="server" Text="FName"></asp:Label>
</td>
<td>
<asp:Label ID="Label49" runat="server" Text="LName"></asp:Label>
</td>
<td>
<asp:Label ID="Label50" runat="server" Text="Tel"></asp:Label>
</td>
<td>
<asp:Label ID="Label51" runat="server" Text="Date"></asp:Label>
</td>
<td>
<asp:Label ID="Label52" runat="server" Text="Program"></asp:Label>
</td>
<td>
<asp:Label ID="Label53" runat="server" Text="Additional"></asp:Label>
</td>
<td>
<asp:Label ID="Label54" runat="server" Text="Comment"></asp:Label>
</td>
<td>
<asp:Label ID="Label55" runat="server" Text="StaffName"></asp:Label>
</td>
<td>
<asp:Label ID="Label56" runat="server" Text="Status"></asp:Label>
</td>
<td>
<asp:Label ID="Label57" runat="server" Text="Edit/Delete"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label58" runat="server" Text="HNID"></asp:Label>
</td>
<td>
<asp:Label ID="Label59" runat="server" Text="FName"></asp:Label>
</td>
<td>
<asp:Label ID="Label60" runat="server" Text="LName"></asp:Label>
</td>
<td>
<asp:Label ID="Label61" runat="server" Text="Tel"></asp:Label>
</td>
<td>
<asp:Label ID="Label62" runat="server" Text="Date"></asp:Label>
</td>
<td>
<asp:Label ID="Label63" runat="server" Text="Program"></asp:Label>
</td>
<td>
<asp:Label ID="Label64" runat="server" Text="Additional"></asp:Label>
</td>
<td>
<asp:Label ID="Label65" runat="server" Text="Comment"></asp:Label>
</td>
<td>
<asp:Label ID="Label66" runat="server" Text="StaffName"></asp:Label>
</td>
<td>
<asp:Label ID="Label67" runat="server" Text="Status"></asp:Label>
</td>
<td>
<asp:Label ID="Label68" runat="server" Text="Edit/Delete"></asp:Label>
</td>
</tr>
</tbody>
</table>
<br />
<br />
</asp:Panel>
Tag : .NET, MySQL, Web (ASP.NET)
|
ประวัติการแก้ไข 2011-08-21 00:20:27 2011-08-21 00:21:59
|
|
|
|
|
Date :
2011-08-21 00:19:25 |
By :
zytofle |
View :
970 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณมากครับ
|
|
|
|
|
Date :
2011-08-21 17:03:39 |
By :
zytofle |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|