Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > .NET Framework > Forum > สวัสดีครับ ขอความข่วยเหลือหน่อยครับ พอดีผมจะทำให้เป็น Datetimenow แต่เมื่อใช้กับ Textbox ที่มี Type เป็น type="date"



 

สวัสดีครับ ขอความข่วยเหลือหน่อยครับ พอดีผมจะทำให้เป็น Datetimenow แต่เมื่อใช้กับ Textbox ที่มี Type เป็น type="date"

 



Topic : 132877



โพสกระทู้ ( 86 )
บทความ ( 0 )



สถานะออฟไลน์




สวัสดีครับ ขอความข่วยเหลือหน่อยครับ พอดีผมจะทำให้เป็น Datetimenow แต่เมื่อใช้กับ Textbox ที่มี Type เป็น type="date"
จะไม่แสดงเป็น วันที่ ปัจจุบัน ใช้กับ !Page.IsPostBack ก็ไม่มีผลอะไร มันก็จะเป็นตามภาพ รบกวนแนะนำหน่อยครับ


Code (ASP)
<asp:TextBox type="date" ID="TextBox2"  runat="server" Width="151px" name="party-time"  Height="22px" OnTextChanged="TextBox2_TextChanged"  ></asp:TextBox>


Code (C#)
 DateTime d = DateTime.Now.Date;
  TextBox2.Text =  d.ToString("dd-MM-yyyy");


ฟฟฟ



Tag : Web (ASP.NET), C#









ประวัติการแก้ไข
2019-01-08 08:40:41
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2019-01-08 08:38:37 By : HI View : 809 Reply : 8
 

 

No. 1



โพสกระทู้ ( 9,553 )
บทความ ( 2 )



สถานะออฟไลน์


TextBox2.Text = d.ToString("dd-MM-yyyy");

เปลี่ยนเป็น

TextBox2.Text = d.ToString("yyyy-MM-dd");


input type date value จะมี format เป็น YYYY-MM-DD
ส่วนการแสดงผล จะอ้างอิง format ของ เครื่องคอมนั้นๆ
แต่เวลากำหนด หรืออ่านจาก object ต้องใช้ 2009-01-08






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-01-08 11:50:39 By : Chaidhanan
 


 

No. 2



โพสกระทู้ ( 86 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 1 เขียนโดย : Chaidhanan เมื่อวันที่ 2019-01-08 11:50:39
รายละเอียดของการตอบ ::
ขอโทษครับ แล้วเวลาผมเลือกวันที่ อื่นๆ แล้วทำการ Select หรือ Insert นั้นจะเลือก DateTimeNow ให้ผมอะครับ ไม่สามารถเลือกเป็นวันอื่นได้อะครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-01-08 13:03:04 By : HI
 

 

No. 3



โพสกระทู้ ( 9,553 )
บทความ ( 2 )



สถานะออฟไลน์


เอาโค๊ดมาลงไว้ จะแก้ง่ายกว่า เพราะเขียนให้ดู มันก็เหมือนๆ กับตัวอย่างต่างๆ ที่อยู่บนเวปนั่นแหล่ะ

เอาโค๊ดมาลงจะได้รู้ว่าผิดตรงไหน
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-01-08 14:39:45 By : Chaidhanan
 


 

No. 4



โพสกระทู้ ( 86 )
บทความ ( 0 )



สถานะออฟไลน์


Code (C#)
Code C#

Code (C#)
[cs]using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
using System.Text;
using System.Globalization;
using System.Threading;

namespace Test
{
    public partial class _Default : Page
    {
        SqlConnection conn = new SqlConnection("Data Source=ARTEMIS\\SQL2014;Initial Catalog=SvlITDB;User ID=it;Password=Tigers1234");
        protected void Page_Load(object sender, EventArgs e)
        {
            DateTime d = DateTime.Now.Date;
            TextBox3.Text = d.ToString("yyyy-MM-dd");
            //DateTime daValues1 = DateTime.Now;
            //string MyDt = daValues1.ToString("'HH:mm:ss'");
            //TextBox3.Text = MyDt;

            DateTime daValues = DateTime.Now;
            Random r = new Random();
            int num = r.Next();
            string MyDt2 = daValues.ToString("yyMM-mmss");
            this.TextBox6.Text = num.ToString("'IT','" + MyDt2 + "'");

            if (Session["DeptName"] != null && Session["Tel"] != null) {

                Label12.Text = Session["DeptName"].ToString();
                Label13.Text = Session["Tel"].ToString();
            }

           
        }

        #region Button1_Click
        protected void Button1_Click(object sender, EventArgs e)
        {



            if (DropDownList3.Text == "0")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Myscript", "alert('                         . . . . . . . . . <กรุณาเลือก >> ประเภทของปัญหา << ด้วยค่ะ !!! > . . . . . . . . . ')", true);

            }

            else if (TextBox1.Text == "")
            {

                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Myscript", "alert('                         . . . . . . . . . <กรุณากรอก >> หัวข้อ << ด้วยค่ะ !!! > . . . . . . . . . ')", true);

            }

            else if (Request.Form["Message"] == "" )
            {
                string scriptText = "alert('                         . . . . . . . . . <กรุณากรอก >> รายละเอียด << ด้วยค่ะ !!! > . . . . . . . . . ');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", scriptText, true);
            }
            else if (TextBox3.Text == "")
            {
              
                 string scriptText = "alert('                         . . . . . . . . . <กรุณาใส่ >> วันที่ << ด้วยค่ะ !!! > . . . . . . . . . ');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", scriptText, true);

            }

            else if (TextBox5.Text == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Myscript", "alert('                         . . . . . . . . . <กรุณากรอก >> ชื่อผู้แจ้งปัญหา << ด้วยค่ะ !! > . . . . . . . . . ')", true);


            }
            else {

                if (Session["DeptName"].ToString() == "Human Resources")
                {
                    conn.Open();
                    SqlCommand sqlcom = conn.CreateCommand();
                    sqlcom.CommandText = "INSERT INTO [dbo].[Case] ( [CaseName], [CaseDetail], [CaseDT], [CaseStatusKey], [Requester], [UsrKey], [CaseTypeKey],[CaseCode]) VALUES ( '" + TextBox1.Text + "','" + Request.Form["Message"] + "','" + TextBox3.Text + "',1,'" + TextBox5.Text + "',5,'" + DropDownList3.Text + "','" + TextBox6.Text + "')";
                    sqlcom.CommandType = CommandType.Text;
                    sqlcom.ExecuteNonQuery();
                    conn.Close();


                    string scriptText = "alert('                     . . . . . . . . . <บันทึกการแจ้งปัญหาสำเร็จ > . . . . . . . . . '); window.location='" + Request.ApplicationPath + "RequestionShow.aspx'";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", scriptText, true);

                }
                else if (Session["DeptName"].ToString() == "Accounting")
                {

                    conn.Open();
                    SqlCommand sqlcom = conn.CreateCommand();
                    sqlcom.CommandText = "INSERT INTO [dbo].[Case] ( [CaseName], [CaseDetail], [CaseDT], [CaseStatusKey], [Requester], [UsrKey], [CaseTypeKey],[CaseCode]) VALUES ( '" + TextBox1.Text + "','" + Request.Form["Message"] + "','" + TextBox3.Text + "',1,'" + TextBox5.Text + "',2,'" + DropDownList3.Text + "','" + TextBox6.Text + "')";
                    sqlcom.CommandType = CommandType.Text;
                    sqlcom.ExecuteNonQuery();
                    conn.Close();
                    string scriptText = "alert('                     . . . . . . . . . <บันทึกการแจ้งปัญหาสำเร็จ > . . . . . . . . . '); window.location='" + Request.ApplicationPath + "RequestionShow.aspx'";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", scriptText, true);

                }
                else if (Session["DeptName"].ToString() == "Purchase")
                {

                    conn.Open();
                    SqlCommand sqlcom = conn.CreateCommand();
                    sqlcom.CommandText = "INSERT INTO [dbo].[Case] ( [CaseName], [CaseDetail], [CaseDT], [CaseStatusKey], [Requester], [UsrKey], [CaseTypeKey],[CaseCode]) VALUES ( '" + TextBox1.Text + "','" + Request.Form["Message"] + "','" + TextBox3.Text + "',1,'" + TextBox5.Text + "',9,'" + DropDownList3.Text + "','" + TextBox6.Text + "')";
                    sqlcom.CommandType = CommandType.Text;
                    sqlcom.ExecuteNonQuery();
                    conn.Close();
                    string scriptText = "alert('                     . . . . . . . . . <บันทึกการแจ้งปัญหาสำเร็จ > . . . . . . . . . '); window.location='" + Request.ApplicationPath + "RequestionShow.aspx'";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", scriptText, true);


                }
                else if (Session["DeptName"].ToString() == "Store")
                {

                    conn.Open();
                    SqlCommand sqlcom = conn.CreateCommand();
                    sqlcom.CommandText = "INSERT INTO [dbo].[Case] ( [CaseName], [CaseDetail], [CaseDT], [CaseStatusKey], [Requester], [UsrKey], [CaseTypeKey],[CaseCode]) VALUES ( '" + TextBox1.Text + "','" + Request.Form["Message"] + "','" + TextBox3.Text + "',1,'" + TextBox5.Text + "',11,'" + DropDownList3.Text + "','" + TextBox6.Text + "')";
                    sqlcom.CommandType = CommandType.Text;
                    sqlcom.ExecuteNonQuery();
                    conn.Close();
                    string scriptText = "alert('                     . . . . . . . . . <บันทึกการแจ้งปัญหาสำเร็จ > . . . . . . . . . '); window.location='" + Request.ApplicationPath + "RequestionShow.aspx'";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", scriptText, true);


                }
                else if (Session["DeptName"].ToString() == "Quarrying")
                {

                    conn.Open();
                    SqlCommand sqlcom = conn.CreateCommand();
                    sqlcom.CommandText = "INSERT INTO [dbo].[Case] ( [CaseName], [CaseDetail], [CaseDT], [CaseStatusKey], [Requester], [UsrKey], [CaseTypeKey],[CaseCode]) VALUES ( '" + TextBox1.Text + "','" + Request.Form["Message"] + "','" + TextBox3.Text + "',1,'" + TextBox5.Text + "',13,'" + DropDownList3.Text + "','" + TextBox6.Text + "')";
                    sqlcom.CommandType = CommandType.Text;
                    sqlcom.ExecuteNonQuery();
                    conn.Close();
                    string scriptText = "alert('                     . . . . . . . . . <บันทึกการแจ้งปัญหาสำเร็จ > . . . . . . . . . '); window.location='" + Request.ApplicationPath + "RequestionShow.aspx'";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", scriptText, true);


                }
                else if (Session["DeptName"].ToString() == "Ministry")
                {

                    conn.Open();
                    SqlCommand sqlcom = conn.CreateCommand();
                    sqlcom.CommandText = "INSERT INTO [dbo].[Case] ( [CaseName], [CaseDetail], [CaseDT], [CaseStatusKey], [Requester], [UsrKey], [CaseTypeKey],[CaseCode]) VALUES ( '" + TextBox1.Text + "','" + Request.Form["Message"] + "','" + TextBox3.Text + "',1,'" + TextBox5.Text + "',14,'" + DropDownList3.Text + "','" + TextBox6.Text + "')";
                    sqlcom.CommandType = CommandType.Text;
                    sqlcom.ExecuteNonQuery();
                    conn.Close();
                    string scriptText = "alert('                     . . . . . . . . . <บันทึกการแจ้งปัญหาสำเร็จ > . . . . . . . . . '); window.location='" + Request.ApplicationPath + "RequestionShow.aspx'";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", scriptText, true);

                }
                else if (Session["DeptName"].ToString() == "Rubber")
                {

                    conn.Open();
                    SqlCommand sqlcom = conn.CreateCommand();
                    sqlcom.CommandText = "INSERT INTO [dbo].[Case] ( [CaseName], [CaseDetail], [CaseDT], [CaseStatusKey], [Requester], [UsrKey], [CaseTypeKey],[CaseCode]) VALUES ( '" + TextBox1.Text + "','" + Request.Form["Message"] + "','" + TextBox3.Text + "',1,'" + TextBox5.Text + "',15,'" + DropDownList3.Text + "','" + TextBox6.Text + "')";
                    sqlcom.CommandType = CommandType.Text;
                    sqlcom.ExecuteNonQuery();
                    conn.Close();
                    string scriptText = "alert('                     . . . . . . . . . <บันทึกการแจ้งปัญหาสำเร็จ > . . . . . . . . . '); window.location='" + Request.ApplicationPath + "RequestionShow.aspx'";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", scriptText, true);

                }
                else if (Session["DeptName"].ToString() == "Construction")
                {

                    conn.Open();
                    SqlCommand sqlcom = conn.CreateCommand();
                    sqlcom.CommandText = "INSERT INTO [dbo].[Case] ( [CaseName], [CaseDetail], [CaseDT], [CaseStatusKey], [Requester], [UsrKey], [CaseTypeKey],[CaseCode]) VALUES ( '" + TextBox1.Text + "','" + Request.Form["Message"] + "','" + TextBox3.Text + "',1,'" + TextBox5.Text + "',16,'" + DropDownList3.Text + "','" + TextBox6.Text + "')";
                    sqlcom.CommandType = CommandType.Text;
                    sqlcom.ExecuteNonQuery();
                    conn.Close();
                    string scriptText = "alert('                     . . . . . . . . . <บันทึกการแจ้งปัญหาสำเร็จ > . . . . . . . . . '); window.location='" + Request.ApplicationPath + "RequestionShow.aspx'";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", scriptText, true);


                }
                else if (Session["DeptName"].ToString() == "Concrete")
                {

                    conn.Open();
                    SqlCommand sqlcom = conn.CreateCommand();
                    sqlcom.CommandText = "INSERT INTO [dbo].[Case] ( [CaseName], [CaseDetail], [CaseDT], [CaseStatusKey], [Requester], [UsrKey], [CaseTypeKey],[CaseCode]) VALUES ( '" + TextBox1.Text + "','" + Request.Form["Message"] + "','" + TextBox3.Text + "',1,'" + TextBox5.Text + "',17,'" + DropDownList3.Text + "','" + TextBox6.Text + "')";
                    sqlcom.CommandType = CommandType.Text;
                    sqlcom.ExecuteNonQuery();
                    conn.Close();
                    string scriptText = "alert('                     . . . . . . . . . <บันทึกการแจ้งปัญหาสำเร็จ > . . . . . . . . . '); window.location='" + Request.ApplicationPath + "RequestionShow.aspx'";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", scriptText, true);


                }

                else if (Session["DeptName"].ToString() == "Maintenance")
                {

                    conn.Open();
                    SqlCommand sqlcom = conn.CreateCommand();
                    sqlcom.CommandText = "INSERT INTO [dbo].[Case] ( [CaseName], [CaseDetail], [CaseDT], [CaseStatusKey], [Requester], [UsrKey], [CaseTypeKey],[CaseCode]) VALUES ( '" + TextBox1.Text + "','" + Request.Form["Message"] + "','" + TextBox3.Text + "',1,'" + TextBox5.Text + "',19,'" + DropDownList3.Text + "','" + TextBox6.Text + "')";
                    sqlcom.CommandType = CommandType.Text;
                    sqlcom.ExecuteNonQuery();
                    conn.Close();
                    string scriptText = "alert('                     . . . . . . . . . <บันทึกการแจ้งปัญหาสำเร็จ > . . . . . . . . . '); window.location='" + Request.ApplicationPath + "RequestionShow.aspx'";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", scriptText, true);


                }
                else if (Session["DeptName"].ToString() == "Sale")
                {

                    conn.Open();
                    SqlCommand sqlcom = conn.CreateCommand();
                    sqlcom.CommandText = "INSERT INTO [dbo].[Case] ( [CaseName], [CaseDetail], [CaseDT], [CaseStatusKey], [Requester], [UsrKey], [CaseTypeKey],[CaseCode]) VALUES ( '" + TextBox1.Text + "','" + Request.Form["Message"] + "','" + TextBox3.Text + "',1,'" + TextBox5.Text + "',20,'" + DropDownList3.Text + "','" + TextBox6.Text + "')";
                    sqlcom.CommandType = CommandType.Text;
                    sqlcom.ExecuteNonQuery();
                    conn.Close();
                    string scriptText = "alert('                     . . . . . . . . . <บันทึกการแจ้งปัญหาสำเร็จ > . . . . . . . . . '); window.location='" + Request.ApplicationPath + "RequestionShow.aspx'";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", scriptText, true);


                }
                else if (Session["DeptName"].ToString() == "Marketing")
                {

                    conn.Open();
                    SqlCommand sqlcom = conn.CreateCommand();
                    sqlcom.CommandText = "INSERT INTO [dbo].[Case] ( [CaseName], [CaseDetail], [CaseDT], [CaseStatusKey], [Requester], [UsrKey], [CaseTypeKey],[CaseCode]) VALUES ( '" + TextBox1.Text + "','" + Request.Form["Message"] + "','" + TextBox3.Text + "',1,'" + TextBox5.Text + "',22,'" + DropDownList3.Text + "','" + TextBox6.Text + "')";
                    sqlcom.CommandType = CommandType.Text;
                    sqlcom.ExecuteNonQuery();
                    conn.Close();
                    string scriptText = "alert('                     . . . . . . . . . <บันทึกการแจ้งปัญหาสำเร็จ > . . . . . . . . . '); window.location='" + Request.ApplicationPath + "RequestionShow.aspx'";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", scriptText, true);


                }
                else if (Session["DeptName"].ToString() == "Finance")
                {

                    conn.Open();
                    SqlCommand sqlcom = conn.CreateCommand();
                    sqlcom.CommandText = "INSERT INTO [dbo].[Case] ( [CaseName], [CaseDetail], [CaseDT], [CaseStatusKey], [Requester], [UsrKey], [CaseTypeKey],[CaseCode]) VALUES ( '" + TextBox1.Text + "','" + Request.Form["Message"] + "','" + TextBox3.Text + "',1,'" + TextBox5.Text + "',23,'" + DropDownList3.Text + "','" + TextBox6.Text + "')";
                    sqlcom.CommandType = CommandType.Text;
                    sqlcom.ExecuteNonQuery();
                    conn.Close();
                    string scriptText = "alert('                     . . . . . . . . . <บันทึกการแจ้งปัญหาสำเร็จ > . . . . . . . . . '); window.location='" + Request.ApplicationPath + "RequestionShow.aspx'";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", scriptText, true);



                }
                else if (Session["DeptName"].ToString() == "PouringRubber")
                {

                    conn.Open();
                    SqlCommand sqlcom = conn.CreateCommand();
                    sqlcom.CommandText = "INSERT INTO [dbo].[Case] ( [CaseName], [CaseDetail], [CaseDT], [CaseStatusKey], [Requester], [UsrKey], [CaseTypeKey],[CaseCode]) VALUES ( '" + TextBox1.Text + "','" + Request.Form["Message"] + "','" + TextBox3.Text + "',1,'" + TextBox5.Text + "',25,'" + DropDownList3.Text + "','" + TextBox6.Text + "')";
                    sqlcom.CommandType = CommandType.Text;
                    sqlcom.ExecuteNonQuery();
                    conn.Close();
                    string scriptText = "alert('                     . . . . . . . . . <บันทึกการแจ้งปัญหาสำเร็จ > . . . . . . . . . '); window.location='" + Request.ApplicationPath + "RequestionShow.aspx'";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", scriptText, true);
                 


                }


            }




        }   
        #endregion

        #region Button2_Click
        protected void Button2_Click(object sender, EventArgs e)
        {
            TextBox1.Text = "";

            TextBox5.Text = "";
            DropDownList3.Text = "0";
           
        }

        protected void Button2_Click1(object sender, EventArgs e)
        {

        }

        protected void Button3_Click(object sender, EventArgs e)
        {

        }

        protected void TextBox6_TextChanged(object sender, EventArgs e)
        {

        }

        protected void TextBox7_TextChanged(object sender, EventArgs e)
        {

        }
    }
    }
#endregion


####################################################################################################

Code ASP

Code (ASP)
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Test._Default" %>

<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">

  
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
  

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet"/>
	<link rel="stylesheet" href="css/animate.css"/>
	<link rel="stylesheet" href="css/font-awesome.min.css"/>
	<link rel="stylesheet" href="css/jquery.bxslider.css"/>
	<link rel="stylesheet" type="text/css" href="css/normalize.css" />
	<link rel="stylesheet" type="text/css" href="css/demo.css" />
	<link rel="stylesheet" type="text/css" href="css/set1.css" />
	<link href="css/overwrite.css" rel="stylesheet"/>
	<link href="css/style2.css" rel="stylesheet"/>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  

	<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
		<div class="container">
			<!-- Brand and toggle get grouped for better mobile display -->
			<div class="navbar-header">
				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse.collapse">
					<span class="sr-only">Toggle navigation</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="Default.aspx"><span>
    <img src="http://localhost:51924/img/IT1.gif"  style="height: 65px; width: 70px; margin-top:-18px" /> Suvalee Company</span></a>
           
			</div>
			<div class="navbar-collapse collapse">							
				<div class="menu">
					<ul class="nav nav-tabs" role="tablist">
						<li role="presentation" class="active"><a href="Default.aspx">แจ้งปัญหา</a></li>
						<li role="presentation"><a href="RequestionShow.aspx">แสดงปัญหาที่แจ้ง</a></li>
						<li role="presentation"><a href="Login.aspx">ออกจากระบบ</a></li>						
					</ul>
				</div>
			</div>			
		</div>
	</nav>
      <br />
      <br />
    <p style="text-align:center; font-size:25px; color:black;">ระบบแจ้งปัญหาสารสนเทศ</p>
    
      <p style="margin-left:390px ; font-size:25px">
          <strong>
          <asp:Label ID="Label11" runat="server" Text="แผนก : " Font-Size="18px" style="font-size: medium"></asp:Label>
          </strong><span style="font-size: medium"><strong>&nbsp;
          </strong></span><strong>
          <asp:Label ID="Label12" runat="server" Font-Size="18px" Text="Label" style="font-size: medium"></asp:Label>
          </strong><span style="font-size: medium"><strong>&nbsp;&nbsp;&nbsp;&nbsp; </strong></span><strong> <asp:Label ID="Label10" runat="server" Text="เบอร์โทรศัพท์ : " Font-Size="18px" style="font-size: medium"></asp:Label>
          </strong>&nbsp;<strong><asp:Label ID="Label13" runat="server" Font-Size="18px" Text="Label" style="font-size: medium"></asp:Label>
          </strong>
      </p>
  
     <div class="errorContainer" align="Center" >
    
         <table align="Center" style="width: 34%; height: 230px;"> <tr>
                 <td style="height: 40px; width: 176px; text-align: right; font-size: medium;" class="text-justify" >
                     CODE&nbsp;&nbsp;&nbsp;&nbsp; </td>
                 <td style="height: 40px">
         <asp:TextBox ID="TextBox6" runat="server" OnTextChanged="TextBox6_TextChanged" Width="200px" ReadOnly="true" Enabled="false" Font-Size="14px"></asp:TextBox>
                 </td>
                 
             </tr>
             <tr>
                 <td style="height: 17px; width: 176px; text-align: right; font-size: medium;">
                     ประเภทปัญหา&nbsp;&nbsp;&nbsp;&nbsp; </td>
                 <td style="height: 40px">
                     <asp:DropDownList ID="DropDownList3" runat="server" Font-Size="14px">
                         <asp:ListItem Value="0">===กรุณาเลือก===</asp:ListItem>
                         <asp:ListItem Value="1">Computer</asp:ListItem>
                         <asp:ListItem Value="2">Printer</asp:ListItem>
                         <asp:ListItem Value="3">Wireless</asp:ListItem>
                         <asp:ListItem Value="6">ระบบ Syteline</asp:ListItem>
                         <asp:ListItem Value="4">อื่นๆ</asp:ListItem>
                     </asp:DropDownList>
                 </td>
                 
             </tr>
             
             <tr>
                
                 <td style="width: 176px; height: 28px; text-align: right; font-size: medium;">
                     หัวข้อ&nbsp;&nbsp;&nbsp;&nbsp; </td>
                 <td style="height: 40px">
                     <asp:TextBox ID="TextBox1" runat="server" Font-Size="14px"></asp:TextBox>
                 </td>
             </tr>
             <tr>
                 <td style="width: 176px; height: 71px; text-align: right; font-size: medium;">
                     รายละเอียด&nbsp;&nbsp;&nbsp;&nbsp; </td>
                 <td style="height: 105px">
                     <textarea id="TextArea1" cols="35" name="Message" rows="4"  ></textarea></td>
             </tr>
             <tr>
                 <td style="width: 176px; height: 27px; text-align: right; font-size: medium;">
                     วันที่แจ้งปัญหา&nbsp;&nbsp;&nbsp;&nbsp; </td>
                 <td style="height: 40px">
                     <asp:TextBox ID="TextBox3" runat="server" Font-Size="14px" type="date" name="party-time" Height="22px" ></asp:TextBox>
                 </td>
             </tr>
             <tr>
                 <td style="width: 176px; height: 34px; text-align: right; font-size: medium;">
                     ชื่อผู้แจ้งปัญหา&nbsp;&nbsp;&nbsp;&nbsp; </td>
                 <td style="height: 40px">
                     <asp:TextBox ID="TextBox5" runat="server" Font-Size="14px"></asp:TextBox>
                 </td>
             </tr>
             
         </table>
       
<br />
         <asp:Button ID="Button1" runat="server" Text="บันทึก" OnClick="Button1_Click" align="center" />
         &nbsp;&nbsp;<asp:Button ID="Button2" runat="server" Text="ยกเลิก" align="center" OnClick="Button2_Click1"  />
         <br />
         <br />
         <br />
         <br />
           <br />
         <br />
           <br />
         <br />
        
   </div>
	
	<footer>
		
		
	</footer>
	
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery-2.1.1.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
	<script src="js/wow.min.js"></script>
	<script src="js/jquery.easing.1.3.js"></script>
	<script src="js/jquery.isotope.min.js"></script>
	<script src="js/jquery.bxslider.min.js"></script>
	<script type="text/javascript" src="js/fliplightbox.min.js"></script>
	<script src="js/functions.js"></script>	
	<script type="text/javascript">$('.portfolio').flipLightBox()</script>
  

</asp:Content>


[/vb]


ประวัติการแก้ไข
2019-01-09 07:54:14
2019-01-09 08:41:00
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-01-09 07:52:47 By : HI
 


 

No. 5



โพสกระทู้ ( 86 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 3 เขียนโดย : Chaidhanan เมื่อวันที่ 2019-01-08 14:39:45
รายละเอียดของการตอบ ::
ผมลง CODE ASP กับ C# ที่ใช้ให้ละครับ ผมรบกวนหน่อยนะครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-01-09 07:55:06 By : HI
 


 

No. 6



โพสกระทู้ ( 9,553 )
บทความ ( 2 )



สถานะออฟไลน์


ผมก็ไม่ชำนาญวิธีการเขียนแบบนี้อะครับ มักจะกำหนดตัวแปรใส่ค่า ลงไปตรงๆใน VIEW
แบบใน view ผมจะให้มัน มี tag asp น้อยที่สุด (ติดมาจาก php 5555) และเขียน ตัวรับ request สำหรับเซฟแยก ไปอีกไฟล์ต่างหาก
ไม่ค่อยเขียน ปนกันแบบนี้

Code (C#)
    public partial class _Default : Page
    {
        SqlConnection conn = new SqlConnection("Data Source=ARTEMIS\\SQL2014;Initial Catalog=SvlITDB;User ID=it;Password=Tigers1234");
        protected void Page_Load(object sender, EventArgs e)
        {
            DateTime d = DateTime.Now.Date;  
            TextBox3.Text = d.ToString("yyyy-MM-dd"); // กำหนดตรงนี้ ผมไม่แน่ใจว่า เวลา request ส่งค่ามาเซฟ มันจะเอาค่าไปใส่หรือเปล่า ก็ลงลอง เซทค่าให้ textbox อื่นดู เพื่อจะเห็นความแตกต่างที่ชัดเจน ว่ามันมีผลกับการเซฟ หรือไม่


Code (C#)
<%
  DateTime d = DateTime.Now.Date; // ผมชอบทำใน VIEW มากกว่า 
%>
<script type="text/javascript">
	$('.portfolio').flipLightBox();
	$(document).ready(()=>{
		$('#TextBox3').val(<%=d.toString("yyyy-MM-dd")?>);
	});
</script>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-01-09 13:12:43 By : Chaidhanan
 


 

No. 7



โพสกระทู้ ( 86 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 6 เขียนโดย : Chaidhanan เมื่อวันที่ 2019-01-09 13:12:43
รายละเอียดของการตอบ ::
ได้แล้วครับผมใช้ IsPostBack เอา มันก็ได้เลยครับ ตอนแรกผมใส่ผิดตำแหน่ง ขอบคุณนะครับ

Code (C#)
if(!Page.IsPostBack)
{
 DateTime d = DateTime.Now.Date;
            TextBox3.Text = d.ToString("yyyy-MM-dd");
}




ประวัติการแก้ไข
2019-01-11 08:26:43
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-01-11 08:09:02 By : HI
 


 

No. 8



โพสกระทู้ ( 9,553 )
บทความ ( 2 )



สถานะออฟไลน์


+1 ได้คำสั่งเพิ่มเหมือนกัน ไม่ค่อยได้เขียนแบบนี้ เพราะขี้เกียจศึกษาเพื่ิมนั่นแหล่ะ เพราะมันใช้อย่างอื่นได้อยู่
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-01-11 10:45:02 By : Chaidhanan
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : สวัสดีครับ ขอความข่วยเหลือหน่อยครับ พอดีผมจะทำให้เป็น Datetimenow แต่เมื่อใช้กับ Textbox ที่มี Type เป็น type="date"
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 02
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่