最近做乙個東西用到detailsview,所以看了一下資料,用了一下,以前也沒用過這個控制項,不過與gridview結合起來使用還不錯的,因為gridview自帶了增、刪、改功能,但沒有增加,detailsview的結合就很好的粥補了這一缺點,也可以使gridview中檢視單條資料記錄的詳細資訊變是更加方便。
html中的**:
<%@ page language="c#" autoeventwireup="true" codefile="default.aspx.cs" inherits="_default" %>
**隱藏檔案中的實現**:
using system;
using system.data;
using system.configuration;
using system.web;
using system.web.security;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.webcontrols.webparts;
using system.web.ui.htmlcontrols;
using system.data.sqlclient;
public partial class _default : system.web.ui.page }
public void bindusers()
protected void dtvusers_itemcommand(object sender, detailsviewcommandeventargs e)
else if (e.commandname.tolower() == "insert")
catch (exception ce)
finally }
else }
else if (e.commandname.tolower() == "cancel")
else if (e.commandname.tolower() == "edit")
else if (e.commandname.tolower() == "delete")
", id), conn);
try
catch (exception ce)
finally }
} protected void dtvusers_modechanging(object sender, detailsviewmodeeventargs e)
protected void dtvusers_itemdeleting(object sender, detailsviewdeleteeventargs e)
protected void dtvusers_iteminserting(object sender, detailsviewinserteventargs e)
protected void dtvusers_pageindexchanging(object sender, detailsviewpageeventargs e) }
if you want to get the value in readonly mode, it should be:detailsview1.rows[1].cells[1].text//"bpac" field data
if it is in edit mode, it should be:((textbox)detailsview1.rows[1].cells[1].controls[0]).text//value in textbox for "bpac" field
the cells[0] is the headertext, cells[1] is the bound value.
UICollectionView的簡單使用
所屬controller要遵循三個協議 uicollectionviewdatasource,uicollectionviewdelegate,uicollectionviewdelegateflowlayout uicollectionviewflowlayout flowlayout uicol...
BGAQRCode Android的簡單使用
compile com.google.zxing core 3.2.1 xmlns android 這句是使用選擇器框架時用到的 xmlns tools package com.huaqiang.zxingdemo 選擇框架用到 android name android.permission.cam...
Android VideoView的簡單使用
mvideoview.setvideouri uri.parse android.resource getpackagename r.raw play 設定乙個 控制器 控制器預設在父布局的地步 可以自己實現控制器布局 mvideoview.setmediacontroller new mediac...