业务逻辑>表现层>列表控件 数据选择>手动绑定到数据源

首先是前台页面:

 

  1 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="CH9_DemoForm003.aspx.cs" Inherits="CH9_DemoForm003" %>
  2 
  3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4 
  5 <html xmlns="http://www.w3.org/1999/xhtml">
  6 <head id="Head1" runat="server">
  7     <title>示范以程序控制方式绑定列表类型控件</title>
  8     <style type="text/css">
  9         #form1
 10         {
 11             text-align: center;
 12         }
 13         body
 14         {
 15             font-family: Lucida Sans Unicode;
 16             font-size: 10pt;
 17         }
 18         button
 19         {
 20             font-family: tahoma;
 21             font-size: 8pt;
 22         }
 23         .highlight
 24         {
 25             display: block;
 26             color: red;
 27             font: bold 24px Arial;
 28             margin: 10px;
 29         }
 30         .style1
 31         {
 32             width: 312px;
 33             text-align: left;
 34         }
 35     </style>
 36 </head>
 37 <body>
 38     <form id="form1" runat="server">
 39     <div>
 40       <table border="1">
 41             <tr>
 42                 <td colspan="2">
 43                     Hi
 44                     <b><%=Request.LogonUserIdentity.Name%></b>
 45                     您好,您的 IP 地址是
 46                     <b><%=Request.UserHostAddress%></b>
 47                     <br />欢迎光临并请选择下列选项:
 48                 </td>
 49             </tr>
 50             <tr>
 51                 <td style="text-align: right">
 52                     请选择您的性别:
 53                 </td>
 54                 <td class="style1">
 55                     <asp:RadioButtonList ID="Gender_RadioButtonList" runat="server">
 56                         <asp:ListItem Selected="True" Value="0">女</asp:ListItem>
 57                         <asp:ListItem Value="1">男</asp:ListItem>
 58                     </asp:RadioButtonList>
 59                 </td>
 60             </tr>
 61             <tr>
 62                 <td style="text-align: right">
 63                     请问您已婚或未婚:
 64                 </td>
 65                 <td class="style1">
 66                     <asp:ListBox ID="Marital_ListBox" runat="server" Height="45px">
 67                         <asp:ListItem Selected="True" Value="0">未婚</asp:ListItem>
 68                         <asp:ListItem Value="1">已婚</asp:ListItem>
 69                     </asp:ListBox>
 70                 </td>
 71             </tr>
 72             <tr>
 73                 <td style="text-align: right">
 74                     请选择居住地:
 75                 </td>
 76                 <td class="style1">
 77                     <asp:DropDownList ID="Resident_DropDownList" runat="server" Height="22px" 
 78                         Width="123px">
 79                     </asp:DropDownList>
 80                 </td>
 81             </tr>
 82             <tr>
 83                 <td style="text-align: right">
 84                     请选择您的职业:
 85                 </td>
 86                 <td class="style1">
 87                     <asp:DropDownList ID="Job_DropDownList" runat="server" 
 88                         Height="22px" Width="278px">
 89                     </asp:DropDownList>
 90                 </td>
 91             </tr>            
 92             <tr>
 93                 <td style="text-align: right">
 94                     请选择您的专长:
 95                 </td>
 96                 <td class="style1">
 97                     <asp:DropDownList ID="Speciality_DropDownList" runat="server" 
 98                         Height="22px" Width="278px">
 99                     </asp:DropDownList>
100                 </td>
101             </tr>                        
102         </table>       
103     </div>
104     </form>
105 </body>
106 </html>
107 
108 

 

 

Job_DropDownList和Speciality_DropDownList是没有用数据源控件绑定,而是后台代码手动绑定到数据源。

 

后台代码:

 

 1 using System;
 2 using System.Collections;
 3 using System.Configuration;
 4 using System.Data;
 5 using System.Linq;
 6 using System.Web;
 7 using System.Web.Security;
 8 using System.Web.UI;
 9 using System.Web.UI.HtmlControls;
10 using System.Web.UI.WebControls;
11 using System.Web.UI.WebControls.WebParts;
12 using System.Xml.Linq;
13 using System.Data.SqlClient;
14 using System.Collections.Generic;
15 
16 public partial class CH9_DemoForm003 : System.Web.UI.Page
17 {
18     protected void Page_Load(object sender, EventArgs e)
19     {
20         if (!IsPostBack)
21         {
22             // 创建一个连接对象。
23             using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["chtNorthwind"].ConnectionString))
24             {
25 
26                 // 创建一个命令对象。
27                 SqlCommand cmd = new SqlCommand();
28                 cmd.Connection = con;
29                 cmd.CommandText = "SELECT 县市代号, 县市名称 FROM 县市";
30 
31                 // 开启连接。
32                 con.Open();
33 
34                 // 创建一个 SqlDataReader 对象。
35                 using (SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.SingleResult))
36                 {
37                     // 将 DropDownList 控件绑定至 SqlDataReader 对象。                    
38                     this.Resident_DropDownList.DataSource = dr;
39                     this.Resident_DropDownList.DataTextField = "县市名称";
40                     this.Resident_DropDownList.DataValueField = "县市代号";
41                     this.Resident_DropDownList.DataBind();
42                 }
43 
44                 cmd.CommandText = "SELECT 职业类别名称, 职业类别编号 FROM 职业类别";
45                 using (SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.SingleResult))
46                 {
47                     // 将 DropDownList 控件绑定至 SqlDataReader 对象。
48                     this.Job_DropDownList.DataSource = dr;
49                     this.Job_DropDownList.DataTextField = "职业类别名称";
50                     this.Job_DropDownList.DataValueField = "职业类别编号";
51                     this.Job_DropDownList.DataBind();
52                 }
53             }
54 
55             // 创建一个泛型集合来内含 Speciality 对象。
56             List<Speciality> shoppingCart = new List<Speciality>();
57             shoppingCart.Add(new Speciality(1, "数据库设计"));
58             shoppingCart.Add(new Speciality(2, "市场分析"));
59             shoppingCart.Add(new Speciality(3, "交际"));
60             shoppingCart.Add(new Speciality(4, "决策分析"));
61 
62             // 将 DropDownList 控件绑定至泛型集合。
63             Speciality_DropDownList.DataSource = shoppingCart;
64             Speciality_DropDownList.DataTextField = "Name";
65             Speciality_DropDownList.DataValueField = "Id";
66             Speciality_DropDownList.DataBind();
67 
68         }
69 
70     }
71 }
72 
73 public class Speciality
74 {
75     private int _id;
76     public string _name;
77     public int Id
78     {
79         get { return _id; }
80     }
81 
82     public string Name
83     {
84         get { return _name; }
85     }
86 
87     public Speciality(int id, string name)
88     {
89         _id = id;
90         _name = name;
91     }
92 }
93 
94 
95 

 

对于DropDownList 有两种后台绑定方式,一种数据库,另一种泛型集合。

转载于:https://www.cnblogs.com/samwu/archive/2010/08/02/1790778.html

c# net 自定义控件——可写入的DropDownList C#.net web开发中一直没有可读写的dropdownlist控件 此控件是本人开发,一个自动记忆登录的项目中在用 无需写任何代码,引用即可 支持下拉框填写,支持selectchange事件回发 网络上的都只有部分功能,且不美观,属于目前网络上蛮好用的一个控件 立即下载

相关推荐

MFC源代码 列表控件CListCtrl加载图片与文字

该资源主要是讲述使用VS2012 MFC的CListCtrl(列表)控件加载类似于QQ界面的图片与文字数据.主要通过CListCtrl::InsertColumn、InsertItem、SetItemText向列表插入数据,CImageList插入BMP图片或ICON图标.是博客文章http://blog.csdn.net/eastmount/article/details/20085489的源程序,只是显示图片和文字,并没有实现什么功能.其中含详细的注释.希望对大家有所帮助.

WinFrom Json数据绑定TreeView控件核心代码

 需要引用Newtonsoft.Json.dll private void button2_Click(object sender, EventArgs e) { //{\"id\":\"329\",\"txt\":\"IT\"} string json = "[{\"Groupid\": \"1\",\&qu

^菜鸟^ 3841

QGIS:安装Deepness插件+应用

简单的描述了deepness的安装应用历程,重点是记录博主本次遇到的坑

fengyi157的博客 2360

手动绑定的GridView控件,“编辑”“删除”按钮的委托代码怎么写

编辑、更新、取消的事件分别在GridView的事件里设置就可以了,其对应代码如下 编辑 protected void gvtb_PartsKind_RowEditing(object sender, GridViewEditEventArgs e) { gvtb_PartsKind.EditIndex = e.NewEditIndex; Find();//数据绑定 } 更新 protected v

lizhenhuatop的专栏 7329

LinuxCNC---在PC端显示开发板LinuxCNC界面

  今天在调试开发板时,执行开发板上的linuxcnc指令,总是出现如下报错 LINUXCNC - 2.9.0~pre0 application-specific initialization failed: couldn't connect to display "192.168.137.3:1" Error in startup script: invalid command name "image" while executing "image create photo -file $f/$i

中华田园巨龙 3478

团结引擎+OpenHarmony 记录 (持续更新中)

获取不到的原因是因为二者不在同一个线程中,所以数据没有同步。而 globalThis.context 数据进行了同步。(TuanjieMainWorkerHandler.ts中可以看到)在进行绘制 UI 的时候 ,如果组件有 Native API 就可能不会显示出来,例如 web 控件就不能展示出来,刚加上权限的时候 会报错 因为缺少 reason ,添加上就不会报错了。只有纯 UI 控件是可以展示出来的,注释掉 web控件后就可以。

m_cainiaokuaifei的博客 1499

一个用于绑定控制列表、表格控件的C#类源码

下面的资料是关于一个用于绑定控制列表、表格控件的C#类的代码。 using System.Web.UI.WebControls; using System.Web.UI; using System.Data; using System.Data.SqlClient; namespace DotNet.Utilities { public class BindDataControl ...

weixin_44097462的博客 385

Matlab处理气象数据(六)数据的面积加权

由于地理投影导致导致每个像元实际地面面积不同,越靠近北极实际面积越小,越靠近赤道实际面积越大,如果不进行面积加权就简单平均,会导致温度较实际温度偏低。 用以下公式计算地理投影每个像元的面积: double pi = 3.1415926; double R = 6371007.181; //units - m double area = (pi/180.0)*R*R*fabs(sin(dLat1/180.0*pi) - sin(dLat2/180.0*pi)) * fabs(dLon1 - dLo

设计の诗 1万+

总结绑定控件

 通过前面的例子我们看到每次我们要显示数据的时候都要通过一个循环来显示满足条件的数据,这是一个比较麻烦的过程,为此微软定义了一系列的控件专门用于显示数据的格式,通过这些控件可以以可视化的方式查看绑定数据之后的效果。这些控件称之为数据绑定控件。在asp.net中所有的数据库绑定控件都是从BaseDataBoundControl这个抽象类派生的,这个抽象类定义了几个重要属性和一个重要方法:DataSo

lkm00的专栏 877

Transformer实战(2)——循环神经网络详解

循环神经网络 (Recurrent neural networks, RNN) ,RNN 是在文本输入中广泛使用的神经网络。RNN 非常灵活,已被用于解决诸如语音识别、语言建模、机器翻译、情感分析和图像字幕等问题。RNN 利用输入的序列特性,序列输入可以是文本、语音、时间序列以及任何其他元素的出现取决于其前面元素的序列。在本节中,我们介绍了 RNN 及其变体,并学习如何使用 TensorFlow 进行实现。

盼小辉丶的博客 1万+

机器视觉工程师如何进行高速运动物体捕获

硬件方面使用高帧率相机(如工业相机、高速摄像机)确保充足的光照条件使用高性能计算平台减少处理延迟软件方面背景减除技术快速分离运动物体卡尔曼滤波预测物体轨迹ROI技术减少计算量多线程处理提高实时性实际应用中的关键考量针对特定场景调整参数(如阈值、滤波器参数等)平衡计算资源与实时性要求结合特定领域知识优化算法(如物体运动特性)上述示例代码实现了一个基础的高速物体跟踪系统,通过背景减除和卡尔曼滤波实现对高速物体的检测和跟踪。

zhangzhechun_02的博客 630

绑定列表框树型控件

这个我以前在cnblogs上发过,记得那是04年刚刚工作的事。(后来退出博客园了,博客清空了,损失很多技术收藏,原创的东东)还经常看到有些老手不知道怎么实现,寒一个呵呵,本人算法厉害,show一哈 public class WebTree {    DataTable sourceData;    StringBuilder b;    string preIdField;  

pxxx123的专栏 1052

Xilinx ISE系列教程(2):LED点灯工程、仿真、bit下载和mcs固化

bit流生成配置选项很多,支持生成bit/bin/ascii格式的bin文件,是否压缩,配置速度,配置管脚的上下拉,用户ID,数据加载速度,SPI总线宽度,是否支持Readback,程序加密等等。,在之后的文章,我们会以Xilinx Spartan-6系列FPGA XC6SLX16为例,不涉及FPGA开发知识,仅仅是工具的使用,介绍Xilinx ISE开发环境的使用教程和使用技巧。bit文件下载之后,可以看到LED按照我们设计的1s周期闪烁起来了,但是此时如果断电,重新上电程序就丢失了。...

whik1194的博客 2287

关于GridView手动绑定的一段代码,一切尽在不言中

为GridView绑定主键的方法,在前台的DataGrid标签中加 DataKeyNames="ID" 后台获取ID: int id=int.parse(this.GridView.DataKeys[e.RowIndex].Value.Tostring()); 如果DataKeyNames绑定了多个列取法:int id=int.parse(this.GridVi...

weixin_30245867的博客 177

自然语言处理:长文本场景下的关键词抽取实践

自然语言处理:长文本场景下的关键词抽取实践

丨汀、的博客 2082

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

推荐分享一个自定义绑定控件(附源码)

在asp.net中,对于一个以数据处理为主的UI层,我们往往需要写很多的代码去实现数据的绑定,当然我们也需要费一点心思从控件上去收集数据. 下面,我分享一个自定义控件来实现双向绑定。 一.基于控件ID,控件属性和数据源成员的映射 <JerryKai:BindExtender ID="BindExtender1" runat="server"> &lt...

weixin_30580943的博客 137

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

DataList手动绑定控件及获取绑定控件值

<br />前台代码: view plaincopy to clipboardprint? <table cellspacing="1" cellpadding="5" width="99%" align="center" bgcolor="#DCEFFA" border="0"> <tr bgcolor="F2F9FD"> <

ccflower的专栏 925

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

数据绑定(五)使用集合对象作为列表控件的ItemsSource

ItemsSource属性可以接收一个IEnumerable接口派生类的实例作为自己的值,ItemsSource里存放的是一条一条的数据,列表式控件的条目容器会为这些数据传上外衣,只要为ItemsControl对象设置了ItemsSource属性值,ItemsControl对象就会自动迭代其中的数据元素,为每一个数据元素准备一个条目容器,并使用Binding在条目容器与数据元素之间建立起关联,例子

iamsupercola的专栏 6473

绑定列表

#region 文章查询NO.56       ///         /// 文章查询NO.56       ///         /// 起始页索引,从0开始        /// 每页显示数量        /// 总页数        /// 信息总数       //

zf_missyou的专栏 386

如何写一个通用的列表控件

每次有个新的列表界面从适配器到Activity都需要写很多代码。作为一个懒人, 一直想把这些重复的工作给去掉,要做到这点,我们的控件需要有以下的功能 1支持下拉刷新 2支持适配器抽象 3支持切换没有数据界面图片和文字(一般都会有个图片和提示文字) 4支持切换加载失败界面,且点击自动重试(有的项目是点击按钮,有的是直接点击失败界面) 5支持加载更多

gengqiquan的博客 5502

一个简单的Python网页抓取程序

有时候我们在分析网页时,如果能找到网页的某个标签的规律,使用urllib库和re正则表达式库就能搞定,如下面这个网页:上述这个网页以Jobs工作进行分类,我们在chrome浏览器中鼠标右键菜单中选择【检查】,可以看到如下内容:这些代码当然有改进的空间,但已经做得非常出色了。

ccf19881030的专栏 222

Jetpack架构组件深度解析:MVVM+UDF单向数据流的最佳实践

/ 1. UI 状态(不可变、完整描述 UI)= null// 2. 用户事件(来自 View 的意图)// 3. 一次性副作用(事件,不保留)MVVM + UDF 的本质是:用分层隔离复杂度,用单向数据流约束状态变更。View 只负责渲染与事件转发ViewModel 只暴露不可变状态流State 是唯一可信源,Effect 是一次性副作用Jetpack 组件(ViewModel + StateFlow + Coroutines)是这套架构的最佳载体架构不是选出来的,是演进出来的。

2609_95039210的博客 201

LLM之Agent(126)|作者自研Coding Agent:Krelcode Agent Harness 技术全景

例如 Context 与 Memory 事件通常只包含 ID、scope、token、hash 和计数,不携带 Prompt 正文或 Memory 文本,避免观测面变成新的泄密面。支持 install/enable/disable/update/remove 的基础生命周期:解析 manifest、校验、复制/安装到受控目录、加载组件、写入状态、更新 Registry、失败隔离。每轮开始时只刷新允许变化的部分,例如 MCP alive 集合,其他权限、工具禁用和运行模式保持稳定,减少竞态。

wshzd的博客 492
上一篇: “高级文件系统管理”的学习
下一篇: jQuery 原理的模拟代码 -3 事件处理
weixin_34334744
博客等级 码龄11年 4268粉丝 144原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值