.COM과.NET

Hagi 2012. 8. 28. 17:06

<%@ Page Language="C#" AutoEventWireup="true" Inherits="Login_Login" CodeFile="Login.aspx.cs" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">

</head>

<script type="text/javascript">
function chkvalue() {
var adminid = document.getElementById("<%= adminid.ClientID %>");
if (adminid.value == "") {
adminid.focus();
return true;
}
var pswd = document.getElementById("<%= pswd.ClientID %>");
if (pswd.value == "") {
pswd.focus();
return true;
}
return false;
}
</script>

<body>
<form id="form1" > 
 
<fieldset>
   <label><img src="/images/id.gif" alt="아이디" />  
  <asp:TextBox ID="adminid" runat="server></asp:TextBox>
</label>
  <label><img src="/images/pw.gif" alt="비밀번호" />
  <asp:TextBox ID="pswd" runat="server" TextMode="Password" ></asp:TextBox>
   </label>  
  <div><asp:ImageButton ID="btnSubmit" runat="server" ImageUrl="/images/login.gif" onClick="btnSubmit_Click" OnClientClick= "if (chkvalue()) { return false;};"/></div>  
</fieldset>
   
   
</form>
</body>
</html>

 
 
 

.COM과.NET

Hagi 2012. 7. 10. 18:27

// aspx에서 DropDownList( ddlPeriodType)로   

//D:일별, W:주별, M:월별, Q:분기별, Y:년별(default, D) 선택


private void GenerateGridViewColumn()
{   
GridView1.Columns.Clear();
switch (ddlPeriodType.SelectedValue)
{
case "W":
BindWeekData();
break;
case "M":
BindMonthData();
break;
case "Q":
BindQuarterData();
break;
case "Y":
BindYearData();
break;
default:
BindDayData();
break;
}
BindCommonData();
}


private void BindWeekData()
{
BindYearData();

BoundField bfMonth = new BoundField();
bfMonth.HeaderText = "월";
  bfMonth.DataField = "MONTH";
this.GridView1.Columns.Add(bfMonth);

BoundField bfWeek = new BoundField();
bfWeek.HeaderText = "주";
  bfWeek.DataField = "WEEK";
this.GridView1.Columns.Add(bfWeek);
}

private void BindMonthData()
{
BindYearData();

BoundField bfMonth = new BoundField();
bfMonth.HeaderText = "월";
  bfMonth.DataField = "MONTH";
this.GridView1.Columns.Add(bfMonth);
}

private void BindQuarterData()
{
BindYearData();

BoundField bfQuarter = new BoundField();
bfQuarter.HeaderText = "분기";
  bfQuarter.DataField = "QUARTER";
this.GridView1.Columns.Add(bfQuarter);
}

private void BindYearData()
{
BoundField bfYear = new BoundField();
bfYear.HeaderText = "년";
  bfYear.DataField = "YEAR";
this.GridView1.Columns.Add(bfYear);
}

private void BindDayData()
{
BindYearData();

BoundField bfMonth = new BoundField();
bfMonth.HeaderText = "월";
bfMonth.DataField = "CPMONTH";
this.GridView1.Columns.Add(bfMonth);

BoundField bfDay = new BoundField();
bfDay.HeaderText = "일";
bfDay.DataField = "CPDAY";
this.GridView1.Columns.Add(bfDay);
}

private void BindCommonData()
{
  BoundField bfProdName = new BoundField();
  bfProdName .HeaderText = "상품명";
  bfProdName .DataField = "PRODNAME";
this.GridView1.Columns.Add(bfUpcName);

BoundField bfCurrencyCode = new BoundField();
bfCurrencyCode.HeaderText = "통화코드";
bfCurrencyCode.DataField = "CURRENCYCODE";
this.GridView1.Columns.Add(bfCurrencyCode);

BoundField bfTotCnt = new BoundField();
bfTotCnt.HeaderText = "거래건수";
bfTotCnt.DataField = "TOTCNT";
bfTotCnt.DataFormatString = "{0:#,##0}";
this.GridView1.Columns.Add(bfTotCnt);

this.GridView1.DataBind();
}


(참고)

http://imaxicool.tistory.com/category/%E2%98%9E%20.NET%20%20%EB%B0%94%EC%A7%80?page=3


http://www.dotnetspider.com/resources/21757-add-boundfield-colume-gridview-at-runtime.aspx


http://aspalliance.com/785_CodeSnip_How_to_Create_a_BoundField_Dynamically_Using_GridView

 
 
 

.COM과.NET

Hagi 2012. 6. 8. 23:37

http://polyphagia.egloos.com/264124