|
|
|
จากรูปจะเห็นชื่อแฟ้มยาวเกินไปจนทำให้ไปบังชื่อแฟ้มข้างล่างจะแก้ไขได้ไงบ้างครับ |
|
|
|
|
|
|
|
ใช้ Control ตัวไหนครับ ลองเอา Code มาดูหน่อยครับ
|
|
|
|
|
Date :
2011-06-08 17:51:47 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (C#)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SPMLib.DAL.SqlClient;
using SPMLib.Common;
using SPMLib;
using System.Globalization;
namespace SpmWeb.UserControl
{
public partial class DocumentList : BaseUserControl
{
private string _pageNameDefault = "DocumentView.aspx";
public string PageName
{
get { return _pageNameDefault; }
set { _pageNameDefault = value; }
}
private string _year = string.Empty;
public string Year {
get {return _year;}
set { _year = value; }
}
private int _type = 0;
public int Type { get { return _type; } set { _type = value; } }
public int SubJob_id { get { return Util.CInt32DB(Request.QueryString["SubJob_id"]); } }
public int Job_id { get { return Util.CInt32DB(Request.QueryString["Job_id"]); } }
protected byte StepSeq
{
get
{
if (!string.IsNullOrEmpty(Request.QueryString["stepseq"])) return byte.Parse(Request.QueryString["stepseq"]);
else return 0;
}
}
protected byte ActionSeq
{
get
{
if (!string.IsNullOrEmpty(Request.QueryString["actionseq"])) return byte.Parse(Request.QueryString["actionseq"]);
else return 0;
}
}
public int Group_id {
get { return (ViewState["Group_id"] == null) ? 0 : SPMLib.Util.CInt32DB(ViewState["Group_id"]); }
set { ViewState["Group_id"] = value; }
}
private bool _search = false;
public bool Search{get { return _search; }set { _search = value; }}
private string _keywordDefault,_datefrom,_dateTo = string.Empty;
public string Keyword{get { return _keywordDefault; }set { _keywordDefault = value; }}
public string DateFrom { get { return _datefrom; } set { _datefrom = value; } }
public string DateTo { get { return _dateTo; } set { _dateTo = value; } }
public bool typesender {
get { if(ViewState["typesender"] == null) return false;
else return (bool)ViewState["typesender"];
}
set { ViewState["typesender"] = value; }
}
protected byte Template_Id
{
get { return SPMLib.Util.CByte(ViewState["Template_Id"]); }
set { ViewState["Template_Id"] = value; }
}
void Toolbar1_Back_Click(object sender, EventArgs e)
{
Response.Redirect("~/30/DocumentFolder.aspx");
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.GetUserCurrent();
ControlList.ListYear(ddlYear, true);
if (!string.IsNullOrEmpty(Request.QueryString["Template_Id"]))
this.Template_Id = byte.Parse(Request.QueryString["Template_Id"]);
if (!string.IsNullOrEmpty(Request.QueryString["Year"]))
this.Year = SPMLib.Util.CObjectToString(Request.QueryString["Year"]);
if (!string.IsNullOrEmpty(Request.QueryString["PageName"]))
typesender = true;
// Session["DocYear"] =this.Year;
BindData();
img_date_from.Attributes.Add("OnClick", "popUpCalendar($get('" + txtDateFrom.ClientID.Replace('_', '$') + "'));");
img_date_to.Attributes.Add("OnClick", "popUpCalendar($get('" + txtDateTo.ClientID.Replace('_', '$') + "'));");
}
}
private void BindData()
{
DmsDocumentSqlClient o = new DmsDocumentSqlClient();
var p = o.FindPaging(
this.Template_Id,
this.Keyword,
this.Year,
this.DateFrom,
this.DateTo,
PagingControl1.PageSize,
PagingControl1.CurrentPage
,Group_id
);
PagingControl1.TotalRecords = p.RecordCount;
PagingControl1.CurrentPage = PagingControl1.CurrentPage;
Repeater1.DataSource = p.DataCollection;
Repeater1.DataBind();
}
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName.ToLower() == "select")
{
string[] s = e.CommandArgument.ToString().Split('|');
if (typesender)
{
string req = Request.QueryString["PageName"] + "?Subject=" + s[1] + "&Document_Id_ref=" +
s[0] + "&" + Request.QueryString;
JsScript.RegisterClient("ClosePage('" + req + "')", this.Page);
}
else if (this.SubJob_id > 0)
{
TrnSubJobDocAttachmentSqlClient obj = new TrnSubJobDocAttachmentSqlClient();
obj.Insert(new TrnSubJobDocAttachment(SubJob_id, SPMLib.Util.CInt32DB(s[0])));
JsScript.RegisterClient("update_subjob();", this.Page);
}
else if (this.Job_id > 0)
{
Response.Redirect("~/30/Lookup_Box_View.aspx?Document_Id=" + s[0] + "&Job_id=" + this.Job_id + "&stepseq=" + this.StepSeq + "&actionseq=" + this.ActionSeq);
}
else if (Type.Equals(1))
{
Attachment(SPMLib.Util.CInt32DB(s[0]));
}
else
{
Response.Redirect(PageName + "?Subject=" + s[1] + "&Document_Id=" +
s[0] + "&" + Request.QueryString);
}
}
}
private void Attachment(int attachid) {
DmsDocAttachmentSqlClient docAttSql = new DmsDocAttachmentSqlClient();
int docMas = (Session["Doc_id"] != null)?(int)Session["Doc_id"]:0;
DmsDocAttachment obj = new DmsDocAttachment();
obj.Document_id = docMas;
obj.Attach_id = attachid;
if (docAttSql.CheckInsert(obj) == 0)
{
if (docAttSql.Insert(obj))
JsScript.RegisterClient("CloseInternal('" + docMas + "');", this.Page);
}
else {
//JsScript.RegisterClient("InternalAlert('เอกสารไฟล์นี้ถูกแนบแล้วค่ะ');", this);
JsScript.Alert("เอกสารไฟล์นี้ถูกแนบแล้วค่ะ", this.Page);
}
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
PagingControl1.Click += new PagingEventHandler(PagingControl1_Click);
}
void PagingControl1_Click(object sender, EventArgs e)
{
BindData();
}
protected void btnSearch_Click(object sender, EventArgs e)
{
this.Keyword = txtKeyword.Text;
this.Year = (ddlYear.SelectedValue.Equals("0")) ? string.Empty : ddlYear.SelectedValue;
this.DateFrom = GetFromatDateEngFromCalendar(txtDateFrom.Text.Trim());
this.DateTo = GetFromatDateEngFromCalendar(txtDateTo.Text.Trim());
BindData();
}
protected void btnReset_Click(object sender, EventArgs e)
{
txtKeyword.Text = string.Empty;
txtDateFrom.Text = string.Empty;
txtDateTo.Text = string.Empty;
ddlYear.SelectedIndex = 0;
}
#region DateConvert
public DateTime ConvertToDateEng(string date){
try { return DateTime.Parse(date, new CultureInfo("th-TH")); }
catch{return DateTime.MinValue;}
}
public string ConvertDateEngMMDDYYYYToString(DateTime date) {
try {
//MM/DD/yyyy
return string.Format("{0}/{1}/{2}", date.Month, date.Day, (date.Year > 2550) ? date.Year - 543 : date.Year);
}
catch { return string.Empty; }
}
public string GetFromatDateEngFromCalendar(string date)
{
DateTime dt = ConvertToDateEng(date);
if (dt.Equals(DateTime.MinValue))
return string.Empty;
else
return ConvertDateEngMMDDYYYYToString(dt);
}
#endregion
}
}
|
|
|
|
|
Date :
2011-06-09 10:37:07 |
By :
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แล้วก้อขอถามอีกอย่าง คือ ผมแก้ไข้code ช่น ex.js แล้วพอรันมันกลับ รันเป็นตัวที่ไม่ได้แก้ไข ผมงงกมาก ดูตรงชื่อไฟล์ก้อขึ้น เป็น ex.js[dynamic]
|
|
|
|
|
Date :
2011-06-09 10:42:00 |
By :
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|