![ASPNET五大數(shù)據(jù)控件_第1頁](http://file4.renrendoc.com/view10/M02/21/3A/wKhkGWWVBjiAcxyEAAJO0DmBEr4181.jpg)
![ASPNET五大數(shù)據(jù)控件_第2頁](http://file4.renrendoc.com/view10/M02/21/3A/wKhkGWWVBjiAcxyEAAJO0DmBEr41812.jpg)
![ASPNET五大數(shù)據(jù)控件_第3頁](http://file4.renrendoc.com/view10/M02/21/3A/wKhkGWWVBjiAcxyEAAJO0DmBEr41813.jpg)
![ASPNET五大數(shù)據(jù)控件_第4頁](http://file4.renrendoc.com/view10/M02/21/3A/wKhkGWWVBjiAcxyEAAJO0DmBEr41814.jpg)
![ASPNET五大數(shù)據(jù)控件_第5頁](http://file4.renrendoc.com/view10/M02/21/3A/wKhkGWWVBjiAcxyEAAJO0DmBEr41815.jpg)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
ASPNET五大數(shù)據(jù)控件
i.插入功能方面:
DetailsView與FormView具有插入功能,其它控件沒有
2.模板
DataList\FonnView\Repeater三種務(wù)必編輯模板,而
GridView與DetailsView只有在將列轉(zhuǎn)換成模板列以后才會出現(xiàn)各類模板.
3.自動分頁功能
GridView,DetailsView與FormView都是2.0版本新增控件,內(nèi)置了分頁,排序等等功能,
其他需要手工定義
4.數(shù)據(jù)呈現(xiàn)方式:
GridView,DataList.Repeator用于呈現(xiàn)多列數(shù)據(jù),
DetailsView,FormView用于呈現(xiàn)單列數(shù)據(jù),即常用的數(shù)據(jù)明細(xì).
DataList與Reapter都需要編輯模板列,而在模板列當(dāng)中能夠添加TextBox,同時(shí)能夠指定
TextBox的ID從而實(shí)現(xiàn)提取用戶輸入的值,但是DataGrid與GridView兩個件是不需要編輯
模板的,它的編輯功能是自動生成的我們無法明白那些文本框的ID,也就無法通過ID來獲
取用戶的輸入,那么能夠通過對單元格的引用來實(shí)現(xiàn):
privatevoidDataGrid1_UpdateCommand(objectsource,xx)
(
stringbkid=DataGrid1.DataKeys[e.Item.IlemIndex].toString();〃提取主鍵
stringbktitle=((TextBox)e.Item.Cells[l].Controls⑼).Text;//提取用戶的輸入
)
一.進(jìn)入編輯狀態(tài):
DataList1.Edititemindex=e.Item.Itemlndex;
DataGrid1.Edititemindex=e.Item.Itemindex;
GridView1.Editindex=e.NewEditlndex;
DetailsView1.ChangeMode(DetailsViewMode.Edit);//進(jìn)入編輯狀態(tài)
DetailsViewLChangeMode(DetailsViewMode.ReadOnly);//iM出編輯狀態(tài)
二.設(shè)置主鍵:
DataListl.DataKeyField=nbkidn;
DataGridLDataKeyField="bkidn;
string[]str={"bkid"};
GridView1.DataKeyNames=str;
三.提取主鍵:
stringbkid=DataListl.DataKeysfe.Item.ItemIndex].ToString();//DataList
stringbkid=DataGrid1.DataKeys[e.Item.Itemindex].ToString();//DataGrid
stringbkid=GridView1.DataKeysfe.Rowindex].Value.ToString();//GridView
stringbkid=DetailsView1.DataKey[0].ToString();
四.查找控件:
stringbktitle=((TextBox)e.Item.FindControl("txtTile',)).Text;//DataList
stringbktitle=((TextBox)e.Item.Cells[1].Controls[0]).Text;//DataGrid
stringbktitle=((TexlBox)GridViewl.Rows[e.RowIndex].Cells[l].Controls[0]).Text;
stringbktitle=((TextBox)DetailsView1.Rows[1].Cells[1].Controls[0]).Text;
注意查找控件有兩種方法:(各數(shù)據(jù)綁定控件的都能夠用下面兩種方法進(jìn)行查找)
1.假如明白控件的ID能夠用這種方法
((TextBox)e.Item.FindControl("txtTile")).Text;〃這是查找
2.假如不明白控件的ID可用這種方法
((TexlBox)e.Item.Cells[l].Controls[0]).Texl;〃這是索引
五.給刪除按鈕添加確認(rèn):
protectedvoidDataList1_ItemDataBound(objectsender,DataListltemEventArgse)
(
if(e.Item.ItemType==ListltemType,Ilem||e.Item.ItemType
ListltemType.Alternatingltem)
(
LinkButtonIbtn=(LinkButton)e.Item.FindControl("lbtndelete");
lbtn.Attributes.Add(,,OnClickM,"returnconfirm('確定要刪除嗎?
protectedvoidDataGridl_ItemDataBound(objectsender,DataGridltemEventArgse)
(
if(e.Item.ItemType==ListItemType.Item||
e.Item.ItemType==ListItemType.AlternatingItem)
(
LinkButtonIbtn=(LinkButton)e.Item.Cells[3].Controls[0];
Ibtn.Attributes.Add("OnClick","returnconfirm('確認(rèn)刪除?')”);
)
)
protectedvoidGridView1_RowDalaBound(objectsender,GridViewRowEventArgse)
(
if(e.Row.RowType==DataControIRowType.DataRow)
(
stringstrid=e.Row.CeHs[0].Text;〃獲取第一行的字段值;
e.Row.Cells[3].Attributes.Add("OnClick","returnconfirm('確認(rèn)冊lj除
\"“+strid+“\"?')”);
〃用了兩個轉(zhuǎn)義符將第一列的值用引號括起來,注意轉(zhuǎn)義符后面一個將不被解
釋,是直接放上去;
)
}
ASP.NET程序中常用的三十三種代碼(1)
ASP.NET程序中常用的三十三種代碼(6)</ASP:TEMPLATECOLUMN>
<ASP:TEMPLATECOLUMNheadertext="選中">
<HEADERSTYLEwrap=',Falseuhorizontalalign=nCentern></HEADERSTYLE>
<ITEMTEMPLATE>
<ASP:CHECKBOXid=nchkExport"runat=nservern/>
</ITEMTEMPLATE>
<EDITITEMTEMPLATE>
<ASP:CHECKBOXid=MchkExportONnrunat=userver"enabled二“true”/>
</EDITITEMTEMPLATE>
</ASP:TEMPLATECOLUMN>
后臺代碼
protectedvoidCheckAll_CheckedChanged(objectsender,System.EventArgs
e)
(
〃改變列的選定,實(shí)現(xiàn)全選或者全不選。
CheckBoxchkExport;
if(CheckAl1.Checked)
(
foreach(DataGridltemoDataGridlteminMyDataGrid.Items)
(
chkExport=(CheckBox)oDataGridltem.FindControl(z,chkExportz,);
chkExport.Checked=true;
)
)
else
(
foreach(DataGridltemoDataGridlteminMyDataGrid.Items)
(
chkExport=(CheckBox)oDataGridltem.FindControl(/zchkExportz,);
chkExport.Checked=false;
)
)
)
17.數(shù)字格式化
[<%#Container.Dataltem("price")%>的結(jié)果是500.0000,如何格式化
為500.00?】
<%#Container.Dataltem("price","{0:¥#,##0.00},z)%>
inti=123456;
strings=i.ToString('###,###.00");
18.日期格式化
【aspx頁面內(nèi):<%#
DataBinder.Eval(Container.Dataltem,z/Company_Ureg_Datez/)%>
顯示為:2004-8T119:44:28
我只想要:2004-8-11]
<%#
DataBinder.Eval(Container.Dataltem,“Company_Ureg_Date","{0:yyyy-M-d}”
)%>
應(yīng)該如何改?
【格式化日期】
取出來,通常是
object((DateTime)objectFromDB).ToString(^yyyy-MM-dd^);
【日期的驗(yàn)證表達(dá)式】
A.下列正確的輸入格式:[2004-2-29],[2004-02-2910:29:39pm],
[2004/12/31]
((\d{2}(([02468][048])([13579][26]))[\-\/\s]?((((0?[13578])(1[02]))[
\-\/\s]?((0?[l-9])(El-2][0-9])(3[01])))(((0?[469])(11))[\-\/\s]?((0?[
1-9])([1-2][0-9])(30)))(0?2[\-\/\s]?((0?[l-9])([1-2][0-9])))))(\d(2)(
([02468][1235679])([13579][01345789]))[\-\/\s]?((((0?[13578])(l[02]))
[\-\/\s]?((0?[l-9])([1-2][0-9])(3[01])))(((0?[469D(11))[\-\/\s]?((0?
[1-9])([1-2][0-9])(30)))(0?2[\-\/\s]?((0?[l-9])(l[0-91)(2[0-8]))))))(
\s(((0?[1-9])(1[0-2]))\:([0-5][0-9])((\s)(\:([0-5][0-9])\s))([AMPMamp
m]{2,2})))?$
<>
ASP.NET程序中常用的三十三種代碼(8)<ItemTemplate>
<asp:TextBoxid=,,DanJian,*runat=Server5Text=,<%#
DataBinder.Eval(Container.DataItem,"DG_DanJianu)%>,
onkeyup="javascript:DoCal()”
/>
<asp:RegularExpressionValidatorid=nrevS2"runat=nserver"ControlToValidate=uDanJiann
ErrorMessage=Hmustbenumeric"ValidationExpression=>,A\d+(\.\d*)?$H/>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumnHeaderText="金額”,
<ItemTemplate>
<asp:TextBoxid="JinE"runat=Server?Text=,<%#
DataBinder.Eval(Container.DataItem,"DG__JinE")%>'/>
</ItemTemplate>
</asp:TemplateColumn><scriptlanguage="javascriptu>
functionDoCal()
(
vare=event.srcElement;
varrow=e.parentNode.parentNode;
vartxts=row.all.tags(nINPUTH);
if(!txts.lengthtxts.length<3)
return;
varq=txts[txts.length-3].value;
varp=txts[txts.length-2].value;
if(isNaN(q)isNaN(p))
return;
q=parselnt(q);
p=parseFloat(p);
txts[txts.length-1].value=(q*p).toFixed(2);
}
</script>
24.datagrid選定比較底下的行時(shí),為什么總是刷新一下,然后就滾動到了最上面,剛才選定的
行因屏幕的關(guān)系就看不到了。
page_load
page,smartNavigation=true
25.在Datagrid中修改數(shù)據(jù),當(dāng)點(diǎn)擊編輯鍵時(shí),數(shù)據(jù)出現(xiàn)在文本框中,怎么操縱文本框的大
?。?/p>
privatevoidDataGridl_ItemDataBound(objsender,DataGridltemEventArgse)
(
for(inti=0;i<e.Item.Cells.Count-1;i++)
if(e.Item.ItemType==ListItemType.EditType)
(
e.Item.Cells[i].Attributes.Add(〃Width〃,〃80px〃)
)
}26.對話框
privatestaticstringScriptBegin="〈scriptlanguage=\〃JavaScript\〃
〉〃;
privatestaticstringScriptEnd=//</script>/,;
publicstaticvoidConfirmMessageBox(stringPageTarget,stringContent)
(
stringConfirmContent=/,var
retValue=window.confirm(?〃+Content+〃');〃+〃if(retValue){window,locat
ion=,〃+PageTarget+〃,;}〃;
ConfirmContent=ScriptBegin+ConfirmContent+ScriptEnd;
27.將時(shí)間格式化:stringaa=DateTime.Now.ToString(^yyyy年MM月
dd日〃);
1.1取當(dāng)前年月日時(shí)分秒
current?ime=System.DateTime.Now;
1.2取當(dāng)前年
int年二DateTime.Now.Year;
1.3取當(dāng)前月
int月二DateTime.Now.Month;
1.4取當(dāng)前日
int日二DateTime.Now.Day;
1.5取當(dāng)前時(shí)
int時(shí)二DateTime.Now.Hour;
1.6取當(dāng)前分
int分二DateTime.Now.Minute;
1.7取當(dāng)前秒
int秒二DateTime.Now.Second;
h8取當(dāng)前毫秒
int毫秒=DateTime.Now.Millisecond;
28.自定義分頁代碼:
先定義變量:
publicstaticintpageCount;〃總頁面數(shù)
publicstaticintcurPageIndex=l;〃當(dāng)前頁面
下一頁:
if(DataGridl.CurrentPagelndex<(DataGridl.PageCount-1))
DataGridl.CurrentPagelndex+=1;
curPageIndex+=l;
)
bind();//DataGridl數(shù)據(jù)綁定函數(shù)
上一頁:
if(DataGridl.CurrentPagelndex>0)
(
DataGridl.CurrentPagelndex+=1;
curPageIndex-=l;
)
bindO;//DataGridl數(shù)據(jù)綁定函數(shù)
直接頁面跳轉(zhuǎn):
inta=int.Parse(JumpPage.Value.TrimO);//JumpPage.Value.TrimO為跳轉(zhuǎn)
值
if(a<DataGridl.PageCount)
{
this.DataGridl.CurrentPagelndex=a;
)
bindO;
29.DataGrid使用:
添加刪除確認(rèn):
privatevoidDataGridl_ItemCreated(objectsender,
System.Web.UI.WebControls.DataGridltemEventArgse)
(
foreach(DataGridltemdiinthis.DataGridl.Items)
f(di.ItemType==ListItemType.Itemdi.ItemType==ListItemType.Alternating
Item)
{((LinkButton)di.Cells[8].Controls[0]).Attributes.Add(zzonclick
'「returnconfirm確認(rèn)刪除此項(xiàng)嗎?');〃);
)
)
}樣式交替:
ListltemTypeitemType=e.Item.ItemType;
repeater控件用來循環(huán)輸出
摸板介紹:
<ItemTemplate>正常項(xiàng)目顯示模板1357行顯示v/ItemTemplate>
vAlte「natingItemTemplate>交錯項(xiàng)顯示模板2468行顯示v/AlternatingltemTemp
late>
vSeparato門"emplate〉每行分隔項(xiàng)模板v/Separato「Template>
<HeaderTemplate>頁眉v/HeaderTemplate>
<FooterTemplate>5XW</FooterTemplate>
數(shù)據(jù)綁定中Container的使用
<%#((DataRowView)Container.DataItem)["num"]%>或者者
<%#DataBinder.Eval(Container,DataItem,"num"/'{0}")%>效果同asp中
<%%=rs(,'num',)>
從容器中取出num列
<%#DataBinder.Eval(Container.DataItem/'num"z"{0:c}")%>{}中既是要生成的
數(shù)據(jù)c表示輸入人民幣符號。
如下例:
數(shù)據(jù)庫對象的建立
con.Open();
SqlDataAdaptersad=newSqlDataAdapte「();〃建立數(shù)據(jù)適配器對象
sad.SelectCommand=newSqlCommand("select*fromperson",con);//
實(shí)例化
DataSetds=newDataSet();〃定義數(shù)據(jù)集
sad.Fill(ds,“info”);〃使用數(shù)據(jù)適配器填充數(shù)據(jù)集填充到info表中
this.Repeaterl.DataSource=€15.丁己13后5[肉肝0”];〃設(shè)置數(shù)據(jù)源
this.Repeaterl.DataBind();〃綁定
<asp:RepeaterID="RepeaterlHrunat="server">
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItemJpname”J姓名:{0}")%>
<%#DataBinder.Eval(Container.DataItem,"psex")%>
</ItemTemplate>
<AlternatingItemTemplate>
<fontcolor=blue>
<%#DataBinder.EvaKContainer.Dataltem/'pname","^^;:{0}")%>
<%#DataBinder.Eval(Container.DataItem,"psex")%></font>
</AlternatingItemTemplate>
vHeaderTemplate>頁眉
</HeaderTemplate>
<FooterTemplate>MW
</FooterTemplate>
<SeparatorTemplate>
<hrcolor=bluesize=l/>
</SeparatorTemplate>
</asp:Repeater>
分頁的設(shè)計(jì):
intcurpage=1;
PagedDataSourceps=newPagedDataSource();
ps.DataSource=ds.Tables["info"].Defaultview;
ps.AllowPaging=true;
ps.PageSize=4;
ps.CurrentPagelndex=cur1;
this.Repeaterl.DataSource=ps;〃設(shè)置數(shù)據(jù)源
this.Repeated.DataBind();〃綁定
每次點(diǎn)擊時(shí)改變''curpage"的值即可。
下一頁curpage加一就能夠了
在表格中顯示的實(shí)現(xiàn):
1>在頁眉與頁腳中分別加入vtable>v/table>
<HeaderTemplate><table></HeaderTemplate>
<FooterTemplatex/table></FooterTemplate>
2、在v/ItemTemplate>vtr>vtd>v%#%></tdxtr><AlternatingItemTempl
ate>
<->數(shù)據(jù)庫綁定:
con.Open();
SqlDataAdaptersda=newSqlDataAdapter();
sda.SelectCommand=newSqlCommand("select*fromperson”,con);
DataSetds=newDataSet();
sda.Fill(ds,"person'1);
this.DataListl.DataKeyField="pidH;
this.DataListl.DataSource=ds.Tables["person"];
this.DataListl.DataBind();
<二>Datalist屬性生成器
編輯更新,刪除,取消的CommandName分另U是editupdatedeletecancel,這
樣在datalist的事件中就能夠直接響應(yīng)這些事件,以便進(jìn)行操作。
樣式有列表如下:
<asp:DataListID="DataListl"runat="server"OnItemCommand=nDataListl_Ite
mCommand"OnEditCommand="DataListlEditCommand"OnCancelCommand="
DataListl_CancelCommand"OnUpdateCommand="DataListl_UpdateCommand">
<ItemTemplate>
<asp:LinkButtonID="LinkButtonl"runat="servernCommandName="sel
ect”>查看全面信息v/asp:LinkBut±on>
<asp:LinkButtonID="LinkButton2"runat="server"CommandName=
"edit"OnClick=',LinkButton2_Click">tlS$t</asp:LinkButton>
<asp:LinkButtonID="LinkButton5"runat="serverHCommandName=
"delete”>刪除v/asp:LinkButton>v%#DataBinder.Eval(Container.DataItem,"pna
me")%><%#DataBinder.Eval(Container.DataItemz"psex")%>
protectedvoidDataListl_CancelCommand(objectsource,DataListCommandE
ventArgse)
{
this.DataListl.Editltemlndex=-1;//取消
this.DataListl.DataBind();
}
protectedvoidDataListl_UpdateCommand(objectsource,DataListCommand
EventArgse)〃更新
{
stringpid=this.DataListl.DataKeys[e.Item.Itemindex].ToString();
stringname=((TextBox)e.Item.FindControl("TextBoxl")).Text;
SqlConnectioncon=connecttion.ado.sqldb();
con.Open();
SqlCommandcmd=newSqlCommand("updatepersonsetpname=M,4-
name+'"wherepid='"+pid+""\cori);
cmd.ExecuteNonQuery();
this.DataListl.Editltemlndex=-1;
this.DataListl.DataBind();
Response.Write(pid+name);
}
分頁
protectedvoidDataGridl_PageIndexChanged(objectsource,DataGridPageChan
gedEventArgse)
<
this.DataGridl.CurrentPagelndex=e.NewPagelndex;
this.datagridview();
}
隱藏列
this.DataGridl.Columns[2].Visible=false;〃隱藏第三列(只是表面上的隱藏)
this.datagridview();
鼠標(biāo)通過每行時(shí)高亮顯示:
protectedvoidDataGridl_ItemDataBound(objectsender,DataGridltemEventAr
gse)
{
if(e.Item.ItemType==ListltemType.Item11e.Item.ItemType==ListI
temType.Alternatingltem)
e.Item.Attributes.Add("onmouseover","c=this.styIe.backgroundcolor;
this.style.backgroundColor='#6699ff'");
n
e.Item.Attributes.Add(onmouseout"z"this.style.backgroundColor=c");
}
)
雙向排序:
DataGridl的SortCommand事件激活排序事件
protectedvoidDataGridl_SortCommand(objectsource,DataGridSortCommandE
ventArgse)
{
if(ViewState["order"]==null)
{
ViewState["order"]="ASC";〃viewstate[”"]同session[""]差不多,儲存
在客戶端
}
else
{
if(ViewState["order"].Tostring()=="ASC")
{
ViewState["order"]="DESC";
}
else
{
ViewState["order"]="ASC";
)
)
SqlConnectioncon=connection.ado.sqldb();
con.Open();
SqlDataAdaptersda=newSqlDataAdapter();
sda.SelectCommand=newSqlCommand("select*fromperson",con);
DataSetds=newDataSet();
sda.Fill(dsz"person");
ds.Tablesf"person'*].Defaultview.Sort=e.SortExpression+"“+Views
tatef'^rder'J.ToStringO;
〃默認(rèn)視圖的Sort屬性就是排序?qū)傩詄.SortExpression就是屬性生成器中排序表達(dá)
式的字段
this.DataGridl.DataSource=ds.Tables["person"].Defaultview;//
this.DataGridl.DataBind();
)
綁定查看全面信息列
r在運(yùn)行時(shí)自動創(chuàng)建列(0
列列表
可用列(外:選定的列
D綁定列圉編號.
由圉按鈕列?3]姓名——1
:-屋]超鏈接列_LJ性別?
圜模板列度]詳細(xì)信息~~
X
HvnprlinkCnhimn屋仲
加眉文本(由:
頁腳文本(£):
|詳細(xì)信息
頁眉圖像①:排序表達(dá)式(目:
二jP口」見船
1」
文本(D:URL(U):
|詳細(xì)
文本字段(冷:URL字段(L):
|pid
文本格式字符串(B):URL格式字符串(由:
|show.aspx?id=-{0}
目標(biāo)⑤:
[blank"^]
將此列轉(zhuǎn)換為模板列
在show.aspx中用stringid=Request.Querystring["id"]接收。
datagridDataKeyfield="id"按照索引取的,使用時(shí)能夠
取得當(dāng)前行的id
當(dāng)要刪除或者者修改每一行時(shí)通過this.DataGridl.DatdKeys[e.Item.Itemindex]來獲得
當(dāng)前行的id
datagrid刪除的實(shí)現(xiàn)
首先在屬性生成器中添加刪除按鈕,然后在dadagrid的DeleteCommand事件中編寫代碼即
可
protectedvoidDataGridl_DeleteCommand(objectsource,DataGridCommandEv
entArgse)
{
stringid=this.DataGridl.DataKeyField[e.Item.Itemindex];
SqlConnectioncon=connecttion.ado.sqldb();
con.Open();
SqlCommandcmd=newSqlCommand("deletefrompersonwherepid="'
4-id+,"",con);
cmd.ExecuteNonQuery();
this.datagridview();
}
假如要在刪除時(shí)顯示確認(rèn)后再刪除功能
在DataGridl_ItemDataBound的事件中加第三行就能夠了
protectedvoidDataGridl_ItemDataBound(objectsender,DataGridltemEventAr
gse)
(
if(e.Item.ItemType==ListltemType.Item11e.Item.ItemType==Listlte
mType.Alternatingltem)〃普通行與交錯行的事件
{
e.Item.Attributes.Add("onmouseover","c=this.styIe.backgroundcolor;
this.style.backgroundColor='#6699ff"');〃鼠標(biāo)在的時(shí)候
e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=c");//
鼠標(biāo)離開的時(shí)候
((LinkButton)(e.Item.Cells[4].Controls[0])).Attributes.Add("onclick","ret
urnconfirm。確認(rèn)刪除嗎?〃點(diǎn)任一行的第5列時(shí)觸發(fā)的事件
}
)
Datagrid的編輯功能:
更新:
stringid=this.DataGridl.DataKeys[e.Item.Itemindex].ToString。;取的更新
行的\d
stringpname=((TextBox)(e.Item.Cells[l].Controls[0])).Text;取的本行第二
個字段文本框的值
stringpsex=((TextBox)(e.Item.Cells[2].Controls[0])).Text;
下面加入數(shù)據(jù)庫就能夠了,
在更新時(shí)可使用驗(yàn)證控件進(jìn)行驗(yàn)證,首先把那一列在屬性生成器中轉(zhuǎn)換成模板列,然后在模板
中添加驗(yàn)證控件就能夠了。
用ASP.NET2.0FormView控件操縱顯示(1)
用戶化
盡管這兩個控件一次顯示一條記錄,DetailsView與FormView的關(guān)鍵差別在于:FonnView
利用用戶定義的模板;而DetailsView則使用行字段。FormView控件沒有預(yù)先定義數(shù)據(jù)布局;相反,
你建立一個包含控件的模板來顯示記錄中的單個字段。模板中包含建立表單所要用到的格式、控
件與綁定表達(dá)式。
你能夠操縱數(shù)據(jù)記錄以三種形式顯示:編輯、查看與添加一條新記錄。另外,你能夠包含與
格式化標(biāo)題與頁腳元素。你還能夠利用FormView控件各個部分中的任何一個有效的ASP.NET
控件。
語法
宣稱與使用一個FormView控件實(shí)例與宣稱與使用一個DetailsView控件實(shí)例非常相似。它
們的要緊區(qū)別是,由于沒有默認(rèn)設(shè)置能夠使用,你務(wù)必在FormView控件中包含顯示數(shù)據(jù)的格式
與模板。列表A顯示了打開FonnView元素標(biāo)
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 個人抵押貸款合同季度范本
- 臨街店鋪購買合同范本
- 二次供水設(shè)備采購合同
- 專業(yè)服裝管理軟件經(jīng)銷合同書
- 上海市股權(quán)轉(zhuǎn)讓合同標(biāo)準(zhǔn)范本
- 二手房銷售代理合同協(xié)議
- 中外合作種植戰(zhàn)略合作合同
- 云計(jì)算服務(wù)提供商數(shù)據(jù)保密合同
- 返聘人員協(xié)議書
- IT行業(yè)員工培訓(xùn)勞動合同范本
- (2024)甘肅省公務(wù)員考試《行測》真題及答案解析
- 醫(yī)院醫(yī)務(wù)人員醫(yī)德考評標(biāo)準(zhǔn)
- 小紅書種草營銷師(初級)認(rèn)證考試真題試題庫(含答案)
- 癲癇病人的護(hù)理(課件)
- 企業(yè)資產(chǎn)管理培訓(xùn)
- 2024年WPS計(jì)算機(jī)二級考試題庫350題(含答案)
- 2024年4月27日浙江省事業(yè)單位招聘《職業(yè)能力傾向測驗(yàn)》試題
- 2024年6月浙江省高考地理試卷真題(含答案逐題解析)
- 醫(yī)院培訓(xùn)課件:《如何撰寫護(hù)理科研標(biāo)書》
- 河南省鄭州市2023-2024學(xué)年高二上學(xué)期期末考試 數(shù)學(xué) 含答案
- 2024年山東省濟(jì)南市中考英語試題卷(含答案)
評論
0/150
提交評論