c# สอบถามหน่อยค่ะ asp.net ในหน้า code หาชื่อในหน้า design ไม่เจอค่ะ
มันหา Control ในหน้า .aspx ไม่เจอน่ะครับ ลองเอา code มาดูครับ ทั้ง 2 ตัวเลยครับ ทั้ง .aspx และ .cs ครับ (copy เป็น text มา)
Date :
2012-01-11 16:58:44
By :
webmaster
Code (C#)
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using PAMS_Library;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
using MyComLib;
public partial class Manage : System.Web.UI.Page
{
ClsManage _ClsManage = new ClsManage();
private void setvalue()
{
_ClsManage._Al_id = hdAl_id.Value;
_ClsManage._album_id = txtAl_id.Text;
_ClsManage._album_name = txtAl_name.Text;
_ClsManage._album_detail = txtAl_detail.Text;
_ClsManage._album_dateact = txtAl_time.Text;
_ClsManage._album_place = txtAl_place.Text;
_ClsManage._dep_id = ddlDep_id.SelectedValue;
_ClsManage._type_id = ddlType_id.SelectedValue;
_ClsManage._album_counter = txtAl_count.Text;
_ClsManage._point_total = txtAl_point.Text;
_ClsManage._vote_total = txtAl_vote.Text;
}
protected void Page_Load(object sender, EventArgs e)
{
}
}
Code (ASP)
<%@ Page Language="C#" MasterPageFile="~/design/MasterPage.master" ValidateRequest="false" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %>
<%@ Import Namespace="Artisteer" %>
<%@ Register TagPrefix="artisteer" Namespace="Artisteer" %>
<%@ Register TagPrefix="art" TagName="DefaultMenu" Src="DefaultMenu.ascx" %>
<%@ Register TagPrefix="art" TagName="DefaultHeader" Src="DefaultHeader.ascx" %>
<%@ Register assembly="GMDatePicker" namespace="GrayMatterSoft" tagprefix="cc1" %>
<asp:Content ID="PageTitle" ContentPlaceHolderID="TitleContentPlaceHolder" Runat="Server">
Page title here...
</asp:Content>
<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeaderContentPlaceHolder" Runat="Server">
<art:DefaultHeader ID="DefaultHeader" runat="server" />
</asp:Content>
<asp:Content ID="MenuContent" ContentPlaceHolderID="MenuContentPlaceHolder" Runat="Server">
<art:DefaultMenu ID="DefaultMenuContent" runat="server" />
</asp:Content>
<asp:Content ID="SheetContent" ContentPlaceHolderID="SheetContentPlaceHolder" Runat="Server">
<br />
<br />
<asp:Panel ID="Panel1" runat="server" HorizontalAlign="Center" Width="1032px">
<br />
<br />
<table align="center" bgcolor="#996633" border="0" cellpadding="1"
cellspacing="1" frame="border">
<tr>
<td bgcolor="#FFFFFF" colspan="2" class="style3">
จัดการอัลบั้มภาพกิจกรรม<asp:HiddenField ID="hdAl_id" runat="server" />
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" class="style4">
<div align="left">
รหัสอัลบั้ม <strong> :</strong>
</div>
</td>
<td bgcolor="#FFFFFF" valign="middle" class="style5" align="left">
<asp:TextBox ID="txtAl_id" runat="server" Width="183px"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right" bgcolor="#FFFFFF" class="style4">
<div align="left">
ชื่ออัลบั้ม <strong>:</strong>
</div>
</td>
<td bgcolor="#FFFFFF" class="style5" valign="middle" align="left">
<asp:TextBox ID="txtAl_name" runat="server" MaxLength="200"
Width="187px"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right" bgcolor="#FFFFFF" class="style6">
<div align="left">
รายละเอียด <strong> :</strong>
<br />
</div>
</td>
<td bgcolor="#FFFFFF" class="style7" valign="middle" align="left">
<asp:TextBox ID="txtAl_detail" runat="server" Height="40px" MaxLength="200"
TextMode="MultiLine" Width="339px"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right" bgcolor="#FFFFFF" class="style4">
<div align="left">
ช่วงเวลา <strong> :</strong>
</div>
</td>
<td bgcolor="#FFFFFF" class="style5" valign="middle" align="left">
<asp:TextBox ID="txtAl_time" runat="server" MaxLength="200"
Width="187px"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right" bgcolor="#FFFFFF" class="style4">
<div align="left">
วันที่เริ่ม <strong>:</strong>
</div>
</td>
<td bgcolor="#FFFFFF" class="style5" valign="middle" align="left">
<cc1:GMDatePicker ID="GMDatePicker1" runat="server">
</cc1:GMDatePicker>
</td>
</tr>
<tr>
<td align="right" bgcolor="#FFFFFF" class="style4">
<div align="left">
วันที่สิ้นสุด <strong>:</strong>
</div>
</td>
<td align="left" bgcolor="#FFFFFF" class="style5" valign="middle">
<cc1:GMDatePicker ID="GMDatePicker2" runat="server">
</cc1:GMDatePicker>
</td>
</tr>
<tr>
<td align="right" bgcolor="#FFFFFF" class="style4">
<div align="left">
สถานที่ <strong>:</strong>
</div>
</td>
<td align="left" bgcolor="#FFFFFF" class="style5" valign="middle">
<asp:TextBox ID="txtAl_place" runat="server" MaxLength="50" Width="348px"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right" bgcolor="#FFFFFF" class="style4">
<div align="left">
หน่วยงานที่จัด <strong>:</strong>
</div>
</td>
<td align="left" bgcolor="#FFFFFF" class="style5" valign="middle">
<asp:DropDownList ID="ddlDep_id" runat="server">
</asp:DropDownList>
</td>
</tr>
<tr>
<td align="right" bgcolor="#FFFFFF" class="style4">
<div align="left">
ประเภทกิจกรรม <strong>:</strong>
</div>
</td>
<td align="left" bgcolor="#FFFFFF" class="style5" valign="middle">
<asp:DropDownList ID="ddlType_id" runat="server">
</asp:DropDownList>
</td>
</tr>
<tr>
<td align="right" bgcolor="#FFFFFF" class="style4">
<div align="left">
จำนวนผู้เข้าชมเริ่มต้น <strong>:</strong>
</div>
</td>
<td align="left" bgcolor="#FFFFFF" class="style5" valign="middle">
<asp:TextBox ID="txtAl_count" runat="server" MaxLength="50" Width="140px"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right" bgcolor="#FFFFFF" class="style4">
<div align="left">
คะแนนโหวต <strong>:</strong>
</div>
</td>
<td align="left" bgcolor="#FFFFFF" class="style5" valign="middle">
<asp:TextBox ID="txtAl_point" runat="server" MaxLength="50" Width="141px"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right" bgcolor="#FFFFFF" class="style4">
<div align="left">
จำนวนคนโหวต <strong>:</strong>
</div>
</td>
<td align="left" bgcolor="#FFFFFF" class="style5" valign="middle">
<asp:TextBox ID="txtAl_vote" runat="server" MaxLength="50" Width="140px"></asp:TextBox>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF" colspan="2" height="45" valign="middle">
<asp:Button ID="btnaad" runat="server" Text="เพิ่ม" Height="30px"
Width="88px" />
<asp:Button ID="btnedit" runat="server" Height="30px"
Text="แก้ไข" Width="88px" />
<asp:Button ID="btndelete" runat="server"
Text="ลบ" Height="30px" Width="88px" />
<asp:Button ID="btncancel0" runat="server" Height="30px" Text="ยกเลิก"
Width="88px" />
</td>
</tr>
</table>
<br />
<br />
<br />
<asp:GridView ID="gvManage" runat="server" AutoGenerateColumns="False"
BackColor="White" BorderColor="#DEDFDE" BorderWidth="1px"
CellPadding="4" DataKeyNames="album_id" ForeColor="Black" GridLines="Vertical"
style="margin-left: 0px" BorderStyle="None"
DataSourceID="AccessDataSource1">
<RowStyle BackColor="#F7F7DE" />
<Columns>
<asp:BoundField DataField="album_id" HeaderText="album_id" ReadOnly="True"
SortExpression="album_id">
</asp:BoundField>
<asp:BoundField DataField="album_name"
HeaderText="album_name" SortExpression="album_name">
</asp:BoundField>
<asp:BoundField DataField="album_detail" HeaderText="album_detail"
SortExpression="album_detail" />
<asp:BoundField DataField="album_dateact" HeaderText="album_dateact"
SortExpression="album_dateact" />
<asp:BoundField DataField="album_sdate" HeaderText="album_sdate"
SortExpression="album_sdate" />
<asp:BoundField DataField="album_edate" HeaderText="album_edate"
SortExpression="album_edate" />
<asp:BoundField DataField="album_place" HeaderText="album_place"
SortExpression="album_place"></asp:BoundField>
<asp:BoundField DataField="dep_id" HeaderText="dep_id"
SortExpression="dep_id" />
<asp:BoundField DataField="type_id" HeaderText="type_id"
SortExpression="type_id" />
<asp:BoundField DataField="album_counter" HeaderText="album_counter"
SortExpression="album_counter" />
<asp:BoundField DataField="point_total" HeaderText="point_total"
SortExpression="point_total" />
<asp:BoundField DataField="vote_total" HeaderText="vote_total"
SortExpression="vote_total" />
</Columns>
<FooterStyle BackColor="#CCCC99" />
<PagerStyle BackColor="#F7F7DE" ForeColor="Black"
HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CE5D5A" ForeColor="White" Font-Bold="True" />
<HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/photo.mdb" SelectCommand="SELECT * FROM [Album]">
</asp:AccessDataSource>
<br />
</asp:Panel>
<br />
<br />
<br />
<br />
<br />
<br />
</asp:Content>
<asp:Content ID="Content1" runat="server"
contentplaceholderid="ScriptIncludePlaceHolder">
<script type="text/javascript" src="<%= ResolveUrl("~/jquery.js") %>"></script>
<script type="text/javascript" src="<%= ResolveUrl("~/script.js") %>"></script>
<style type="text/css">
.style3
{
height: 41px;
}
.style4
{
width: 142px;
height: 34px;
}
.style5
{
height: 34px;
width: 370px;
}
.style6
{
width: 142px;
height: 63px;
}
.style7
{
height: 63px;
width: 370px;
}
</style>
</asp:Content>
Date :
2012-01-11 22:22:13
By :
iamkacha
รบกวนช่วยหน่อยนะคะ ขอบคุณมากๆค่ะ
Date :
2012-01-11 22:23:30
By :
iamkacha
ได้แล้วคะ ลืมเปลี่ยน ตรงนี้ค่ะ
Code (C#)
<%@ Page Language="C#" MasterPageFile="~/design/MasterPage.master" ValidateRequest="false" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %>
ขอบคุณมากๆค่ะ ^_______^
Date :
2012-01-12 13:23:22
By :
iamkacha
ประมารนั้น น่าจะหา Link ไฟล์ไม่เจอ ถึงบอกให้ copy .aspx และ .cs มาให้ดูครับ
Date :
2012-01-12 13:34:07
By :
webmaster
Load balance : Server 03