如何给DataGrid添加两个的题头分类显示

如何在DataGrid中显示双标题 控件设置:    BorderColor="White" BorderStyle="Ridge" CellSpacing="1" BorderWidth="2px" BackColor="White"    CellPadding="3" GridLines="None" AllowPaging="True" PageSize="5">                              阅读详情

       我在写PowerDataGrid想到要提供一个查询(有关PowerDataGrid的详细信息参考CSDN论坛中的讨论帖,源码可以在www.foxhis.com/powermjtest/sharepowerdatagrid.rar下载),该查询的构想是这样的:我的这个控件可以通过指定一个SQL语句来显示该语句的内容(其他的功能不叙述了,这不是重点),那么我可以封装一组UI到这个控件里面来实现查询的功能,问题出来了,这个查询通常情况下应该在DataGrid的上面也就是查询结果的上面,我要怎么才能保留原来的题头同时再添加一个题头呢(双题头)?
    问题出来了,改如何解决呢?想了好多办法都不行,如果要将Header重画,那么还要处理排序是前后台的交互问题,那么只能再保留原来Header不动的基础上添加新的Header。无意中发现在分页的时候可以有几种分页显示的方法,在分页面板里面有一个选现可以选择分页的位置,可以选择上下型,在选择这个类型的时候DataGrid在原来的Header上面又多了一行,我们今天就利用这一行来完成我们的任务,今天我们不产生查询的UI而是产生一个分类的题头,我们使用测试数据库Northwind中的Employees来显示数据,首先我们要做的是绑定数据绑定代码如下:
SqlConnection con = new SqlConnection("server=localhost;database=Northwind;uid=sa;pwd=;");
         SqlDataAdapter da = new SqlDataAdapter("SELECT LastName+' '+FirstName as name, BirthDate, Country, Title, HireDate FROM Employees",con);
         DataTable dt = new DataTable();
         da.Fill(dt);
         this.DataGrid1.DataSource = dt;
         this.DataGrid1.DataBind();
}
    接着我们在ItemCreated里面添加适当的代码来完成我们的任务,在PowerDataGrid该事件处理函数里面已经添加了创建一个自定义分页的UI!如果你在PowerDataGrid里面添加需要判断两个(上下)Pager的位置,我们可以使用一个全局变量来判断。
    定义一个全局变量 private int m_CreatePageTimes = 0;
    然后我们为该事件处理函数添加如下代码:
private int m_CreatePageTimes  = 0;
private void DataGrid1_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) {
         ListItemType elemType = e.Item.ItemType;
         if (elemType == ListItemType.Pager) {
            if (m_CreatePageTimes == 0) {
               TableCell cellPerson = (TableCell) e.Item.Controls[0];
               cellPerson.Controls.Clear();
               cellPerson.BackColor = Color.Navy;
               cellPerson.ForeColor = Color.Yellow;
               cellPerson.ColumnSpan = 3;
               cellPerson.HorizontalAlign = HorizontalAlign.Center;
               cellPerson.Controls.Add(new LiteralControl("个人信息"));
 
               TableCell cellJob = new TableCell();
               cellJob.BackColor = Color.Navy;
               cellJob.ForeColor = Color.Yellow;
               cellJob.ColumnSpan = 2;
               cellJob.HorizontalAlign = HorizontalAlign.Center;
               cellJob.Controls.Add(new LiteralControl("工作信息"));
               e.Item.Controls.Add(cellJob);
               m_CreatePageTimes  ++;
            }else if(m_CreatePageTimes ==1){
               // create custom pager UI
            }
         }
    最后是DataGrid的HTML部分的代码如下:
<asp:DataGrid id="DataGrid1" runat="server" AllowPaging="True" AutoGenerateColumns="False" Width="100%"
     PageSize="2">
     <Columns>
      <asp:BoundColumn DataField="name" HeaderText="姓名"></asp:BoundColumn>
      <asp:BoundColumn DataField="BirthDate" HeaderText="生日"></asp:BoundColumn>
      <asp:BoundColumn DataField="Country" HeaderText="国家"></asp:BoundColumn>
      <asp:BoundColumn DataField="Title" HeaderText="头衔"></asp:BoundColumn>
      <asp:BoundColumn DataField="HireDate" HeaderText="雇佣日期"></asp:BoundColumn>
     </Columns>
     <PagerStyle Position="TopAndBottom" Mode="NumericPages"></PagerStyle>
    </asp:DataGrid>
  运行效果如下所示:

  

wpf datagrid 中按钮 动态显示 //若datagrid出现滚动条可能会出现问题需要加上下面俩句话。 //因为出滚动条时,为了显示加速,datagrid会加载一部分数据。另一些数据当滚动时在加载进去 这样初始化获取不到这些数据。 //在datagrid上添加上以下俩句话可以避免预加载数据,使数据全部加载出来 EnableColumnVirtualization="False" EnableRowVirtualization= 阅读详情

相关推荐

WPF DataGrid 列表中,DataGrid.Columns 列根据不同的值显示不同内容

需求:在WPF DataGrid 控件中,有以下列,绑定了一个LogType,值分别是0,1,2,根据不同的值,显示不同的内容以及背景 最终效果图如下: 2.接下来,我们需要定义两个转换器( 和 ),用于根据 LogType 的值来设置背景颜色和显示文本。 2.1 转换器实现 2.2 转换器实现 3.将转换器,添加到资源字典中 在你的 用户控件中,需要将转换器添加到资源字典中,以便在数据模板中使用。添加代码如下:这样就完成了 LogType 列的自定义显示。根据 LogType 的值,可以看到不

build2024 1268

在DATAGRID中使用分类标题

在DATAGRID中使用分类标题 ,我的一篇翻译文章 http://tech.ccidnet.com/pub/article/c322_a70590_p1.html

mdot的专栏 1727

linux 内核vxlan收发包流程

1.vxlan口收包处理流程 前面几章详细介绍了vxlan接口的使用,而且已经知道vxlan是 MAC IN UDP中的封装,因此,在解封装之前,一切按照原有流程走,在此复习一下内核收发包流程(驱动层的数据处理这次不再解析,直接从__netif_receive_skb_core开始) #物理网卡处理中断,触发softirq i40e_intr └─napi_schedule_irqoff #i40e softirq把包放到per cpu backlog,触发softirq i40e_napi_p

魏言华的博客 3831

如何给DataGrid添加双题头分类显示

 我在写PowerDataGrid想到要提供一个查询(有关PowerDataGrid的详细信息参考CSDN论坛中的讨论帖,源码可以在www.foxhis.com/powermjtest/sharepowerdatagrid.rar下载),该查询的构想是这样的:我的这个控件可以通过指定一个SQL语句来显示该语句的内容(其他的功能不叙述了,这不是重点),那么我可以封装一组UI到这个控件里面来实现查询的

879

​苹果开发者账号推送证书配置详细指南​

推送证书的配置是iOS应用实现消息推送的核心步骤。通过生成证书、配置描述文件、集成到服务器三大环节,开发者可快速为App启用APNs服务。建议优先使用更灵活的APNs Auth Key替代传统证书,以减少维护成本。确保拥有有效的苹果开发者账号(个人/公司账号),年费已缴纳。

2332

BLE蓝牙胎压监测

胎压监测系统新技术

qq_41851841的博客 1259

[导入]如何给DataGrid添加两个的题头分类显示

文章来源:http://blog.csdn.net/cuike519/archive/2004/05/07/19339.aspx 转载于:https://www.cnblogs.com/zhaoxiaoyang2/archive/2004/05/07/816425.html

weixin_30640769的博客 92

AI驱动的CNC闭环加工系统:边缘实时控制与IIoT反馈实践

闭环控制是工业自动化的核心概念,指通过实时反馈调节系统输出以逼近目标值;其技术原理在于构建短于被控对象时间常数的确定性反馈链路,从而保障动态响应精度与稳定性。在智能制造落地中,AI正从离线分析工具演进为嵌入式实时决策单元,其核心价值在于将工艺知识模型化、控制指令轻量化、执行路径边缘化。典型应用场景包括CNC加工过程中的振动自适应调参、刀具磨损在线补偿及多机协同优化。本实践聚焦FANUC 0i-MF平台,基于Modbus TCP硬实时通信与轻量LSTM+CNN融合模型,实现217毫秒级AI推理与PMC寄存器直

weixin_29704001的博客 329

如何给DataGrid添加两个的题头分类显示 cuike519 [原作]

标题   如何给DataGrid添加两个的题头分类显示     cuike519 [原作] 关键字   双题头,分类 出处          我在写PowerDataGrid想到要提供一个查询(有关PowerDataGrid的详细信息参考CSDN论坛中的讨论帖,源码可以在www.foxhis.com/powermjtest/sharepowerdatagrid.rar下

rickjelly2004的天空 937

2篇5章1节:实验流行病学的核心特征和设计原则

本文系统阐释实验流行病学的核心定义、四大核心特征、四大基本原则及主流设计类型,结合骨科、肿瘤科、儿科、精神科、内外妇儿及公共卫生等多学科临床实践案例,具象化解读人为干预、随机分组、平行对照、前瞻性设计的核心内涵与应用价值。同时,规范梳理对照、随机、盲法、重复四大研究基本原则,详细介绍临床试验、现场试验、社区试验三类主流研究设计的适配场景与应用差异。

MD Code 195

2023华为od机试C卷【宽度最小的子矩阵】Python 实现

给定一个矩阵,包含N*M个整数,和一个包含K个整数的数组现在要求在这个矩阵中找一个宽度最小的子矩阵,要求子矩阵包含数组中所有的整数。

MISAYAONE的博客 2195

datagrid使用方法

如何给DataGrid添加两个的题头分类显示 http://dev.csdn.net/develop/article/27/27465.shtm DataGrid和DropDownList的一些配合以及使用css定制DataGrid http://www.cnblogs.com/lovecherry/archive/2005/03/25/125525...

weixin_30765577的博客 144

大模型风电功率预测:短期,超短期,中长期的完整实现与代码详解

本文全面介绍了基于深度学习大模型的风电功率预测方法,涵盖超短期(15分钟-1小时)、短期(1-6小时)和中长期(1天-1周)三种时间尺度。文章详细阐述了数据准备与特征工程,包括数据收集、预处理和可视化分析。针对不同时间尺度,分别介绍了Temporal Fusion Transformer (TFT)、Informer和N-BEATS模型的构建、训练与评估方法,并提供了完整的开源代码实现。此外,文章还探讨了模型部署与生产环境集成,包括模型保存与加载、实时预测API以及模型监控与再训练。最后,文章总结了关键创新

专注AI大模型,软件混淆,授权 1919

如何在DataGrid里面产生滚动条而不滚动题头

如何在DataGrid里面产生滚动条而不滚动题头我们在开发的时候一定遇到,使用DataGrid的时候由于不想分页(数据没有那么多)但是又显示不在一页里面,此时我们希望在DataGrid里面出现一个滚动条,可以上下滚动DataGrid里面的数据而不用上下滚动页面,由于写本文的目的是为了说明如何实现,所以对于细节性的问题读者可以自己思考完成(比如:既要分页又要滚动等等)。为了可以滚动DataGri

为天加朵云... 1129

FT2004(D2000)开发实战之网口stmmac报错调试(Failed to reset the dma)

网口stmmac报错调试(Failed to reset the dma)

嵌入式Linux 3598

pscad IEEE标准系统搭建说明

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

WPF DataGrid 添加数据 与 删除数据

<DataGrid ItemsSource="{Binding}" x:Name="DataGrid1" Grid.Row="0" FontSize="12" HorizontalAlignment="Left" Margin="20,40,0,0" VerticalAlignment="Top" Height="172" Width="353" /> 将DataGrid命名为DataGrid1,给后面调用的时候使用。 using System; using System...

思月亮卷的专栏 8455

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

关于 过时的 蛋疼的 MFC + DataGrid 显示设置

由于MFC 已经过时了。。DataGrid的帮助文档 找不到。。。查了很多资料没见到有对于C++ MFC DataGrid的 API (本人比较蠢。。在MSDN上居然找不到,也许是关键词错了,望懂的人能帮忙指导一下 (  0  .  0 )) 一下是自己的一些小总结: 1、 DataGrid 控件自身就支持滚动查看数据,所以别再跟着C# 啥的。。设置参数的。。PS :自带滚动,但不带上

STAR_RUB的博客 2639

深度学习工具包 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")

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

DataGrid中显示数据库中的图片

上一篇文章说了如何把图片保存到数据库中,所以做了个例子,将图片显示在DATAGRID。前面说过了用Response.BinaryWrite()只可以显示一张图片,现在用一个DATAGRID控件,将图片显示在DATAGRID中的IMAGE控件里。(提示:下面的例子没有做分页功能)    里面用了两个图片控件,一个

zcd_137的专栏 1034
上一篇: 编码web.config中的信息
下一篇: 如何在调用线程的时候传递参数
cuike519
博客等级 码龄24年 124粉丝 51原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值