asp.net 动态添加控件 与 取值 !!!
首先法方有3个,这里就说2个实用的。。。
1,直接为 控件 innerhtml 添加值
2,createElement (创建COM)
3,后台 NEW 控件,添加
这里说下 1,2 两个法方!
1:
动态生成 字符串 string inntext=" <table> <tr> <td style=width:300px;text-align:right; >{0}<input id={1} type=text class=wbk /> </td> </tr> </table>"
JS:
document.getElementById("DIV").innerHTML = inntext; //放入 DIV 之中
2:
var table1 =document.createElement("table");
var TBODY1 =document.createElement("TBODY");
var tr1 =document.createElement("tr");
var td1 =document.createElement("td");
td1.setAttribute("width","300px");
td1.style.textAlign = "right";
td1.innerText = "TD:";
var input1 =document.createElement("input");
input1.setAttribute("id","input" + _id[j]); //input1.id
input1.setAttribute("type","text"); //input1.type="text";
input1.setAttribute("className","wbk");// input1.className="wbk";
td1.appendChild(input1);
tr1.append
相关文档:
首页:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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 ......
The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating MVC-based Web applications. The ASP.NET MVC framework is ......
欢迎进入.NET社区论坛,与200万技术人员互动交流 >>进入
ASP.NET 数据控件:GridView,DataList,Repeater ,DetailsView,FormView。
ASP.NET 数据控件综述:
1.前3个用于呈现多条记录,后面2个用于呈现单条数据明细,即常用的记录明细。
2.GridView和DetailsView控件的布局固定,自定义数据显示的布局功能有限,一般 ......