다음은 aspx 코드에있는 것입니다.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DenemeWebForm1.aspx.cs" Inherits="DenemeWebApplication.DenemeWebForm1" %>
<!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">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
<asp:Panel ID="PanelAmk" runat="server">
<table>
<tr>
<td>
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
이 코드는 PanelAmk
이름 패널 등 아무것도 웹 페이지를 작성합니다.
다음은 기본적으로 위의 페이지에 DropDownList
을 추가하는 aspx.cs 코드 (C# 코드)입니다.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace DenemeWebApplication
{
public partial class DenemeWebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DropDownList dropdownlistAmk = new DropDownList();//creates a new dropdownlist
dropdownlistAmk.Items.Add("amk");//adds an item to dropdownlistAmk created above
PanelAmk.Controls.Add(dropdownlistAmk);//and adds dropwdownlistAmk to PanelAmk
}
}
}
당신이 당신이 브라우저에서 페이지를 열 때 그것은 그것 인 경우에 표시됩니다 추가 한 경우? 당신은 당신의 코드를 추가하십시오 수 ...Controls.Add(...)
와 컨트롤에
DropDownList
을 추가 누락'Visible' 속성 false로 설정되지 않았습니다 – Bastardo