当前位置: 首页 > news >正文

杭州企业网站网络营销期末总结

杭州企业网站,网络营销期末总结,十款免费软件app下载入口,定制平台有哪些最近一直在忙于工作项目的事,因此也许久未更新。这次更新一篇,在项目中遇见的一个奇特需求的解决方法。 在项目中,遇见一个需求,老板需要在表格中,加入单选框。 需求模板:需求如图中的工艺做法判定和质量判…

        最近一直在忙于工作项目的事,因此也许久未更新。这次更新一篇,在项目中遇见的一个奇特需求的解决方法。

        在项目中,遇见一个需求,老板需要在表格中,加入单选框。

需求模板:需求如图中的工艺做法判定和质量判定。

        在这个项目中,表格,我们使用的是asp:GridView。单选框我准备使用asp:RadioButtonList。

        需要在GridView中自定义列,则需要使用自定义模板asp:TemplateField。

具体前台代码

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"ForeColor="#333333" GridLines="None"OnRowDeleting="GridView1_RowDeleting" OnRowEditing="GridView1_RowEditing"OnRowUpdating="GridView1_RowUpdating"OnRowCancelingEdit="GridView1_RowCancelingEdit" CssClass="DataGridBorder"Width="900" Font-Size="16px" OnRowDataBound="GridView1_RowDataBound"><FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /><Columns><asp:BoundField DataField="Serial" HeaderText="序号" ReadOnly="true" HeaderStyle-Width="60" /><asp:BoundField DataField="Position" HeaderText="部位名称" ReadOnly="true" HeaderStyle-Width="100" /><asp:TemplateField HeaderText="工艺做法判定"><ItemTemplate><asp:RadioButtonListID="CraftWay" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow"><asp:ListItem Value="正确">正确</asp:ListItem><asp:ListItem Value="错误">错误</asp:ListItem></asp:RadioButtonList></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="质量判定"><ItemTemplate><asp:RadioButtonListID="Quality" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow"><asp:ListItem Value="合格">合格</asp:ListItem><asp:ListItem Value="不合格">不合格</asp:ListItem></asp:RadioButtonList></ItemTemplate></asp:TemplateField><asp:BoundField DataField="DetailNote" HeaderText="备注说明" HeaderStyle-Width="150" /><asp:CommandField HeaderText="选择" ShowSelectButton="True" /><asp:CommandField HeaderText="编辑" ShowEditButton="True" /><asp:CommandField HeaderText="删除" ShowDeleteButton="True" /></Columns><RowStyle CssClass="DataGridHeadr" /><SelectedRowStyle CssClass="GridViewSelectedRowStyle" /><PagerStyle CssClass="DataGridPager" /><HeaderStyle CssClass="GridViewHeaderStyle" />
</asp:GridView>

后台获取表格单选框信息代码

for (int i = 0; i < GridView1.Rows.Count; i++)
{DataRow newRow = dtInfo.NewRow();//部位string position = GridView1.DataKeys[i]["Position"].ToString();// position == "&nbsp;":防止为空时,获取的是:&nbsp:if (position == "&nbsp;") position = "";newRow["Position"] = position;//标识string serial = GridView1.Rows[i].Cells[0].Text;if (serial == "&nbsp;") serial = "";newRow["Serial"] = serial;// 工艺做法判定string craftWay = ((RadioButtonList)(GridView1.Rows[i].FindControl("CraftWay"))).Text;newRow["CraftWay"] = craftWay;// 质量判定string quality = ((RadioButtonList)(GridView1.Rows[i].FindControl("Quality"))).Text;newRow["Quality"] = quality;//备注说明string detailNote = GridView1.Rows[i].Cells[4].Text;if (detailNote == "&nbsp;") detailNote = "";newRow["DetailNote"] = detailNote;dtInfo.Rows.Add(newRow);
}

使用 RadioButtonList)(GridView1.Rows[i].FindControl("单选框ID") 可以获取到该行的单选框,再用 .Text 可以获取到选择的选项数据。用循环读取,可以获取到整个 GridView 表格信息。

后台绑定数据到前台代码

// 副表单选框处理
protected void TableRadlSelect()
{for (int i = 0; i < dtInfo.Rows.Count; i++){// 根据数据绑定,如果为空则清空单选框的选择,不为空则绑定选项if (dtInfo.Rows[i]["CraftWay"].ToString() == "" || dtInfo.Rows[i]["CraftWay"] == null){// 清空选项选择((RadioButtonList)(GridView1.Rows[i].FindControl("CraftWay"))).Items[0].Selected = false;((RadioButtonList)(GridView1.Rows[i].FindControl("CraftWay"))).Items[1].Selected = false;}else{// 绑定选项((RadioButtonList)(GridView1.Rows[i].FindControl("CraftWay"))).Text = dtInfo.Rows[i]["CraftWay"].ToString();}if (dtInfo.Rows[i]["Quality"].ToString() == "" || dtInfo.Rows[i]["Quality"] == null){((RadioButtonList)(GridView1.Rows[i].FindControl("Quality"))).Items[0].Selected = false;((RadioButtonList)(GridView1.Rows[i].FindControl("Quality"))).Items[1].Selected = false;}else{((RadioButtonList)(GridView1.Rows[i].FindControl("Quality"))).Text = dtInfo.Rows[i]["Quality"].ToString();}}
}

        对于后台绑定数据到前台展示,我创建了一个方法,每次需要使用的时候,调用这个方法进行绑定。

http://www.tj-hxxt.cn/news/3919.html

相关文章:

  • 网站底部给网站地图做链接营销推广型网站
  • 做网站可以在哪儿接活百度关键词seo公司
  • 企业英文网站建设推广引流渠道
  • 做夹具需要知道的几个网站品牌营销策划与管理
  • 三级a做爰网站线下推广方案
  • WordPress板块加密信息流广告优化师
  • 成都优秀网站建设软文客
  • 网站设计应该遵循的原则永州网站seo
  • 外国出名的设计网站石家庄关键词排名首页
  • o2o网站制作网络营销出来做什么
  • 信用网站建设内容长沙搜索排名优化公司
  • 义乌网站建设制作商一键优化
  • .com域名做外贸网站seo顾问合同
  • 个人可以采集视频做网站吗亚马逊alexa
  • 哈尔滨网站建设优化公司深圳网络推广方法
  • 知页怎么转换wordpressseo北京优化
  • 高港做网站2020十大网络热词
  • 做区位图的网站app推广工作靠谱吗
  • 吉林省 网站建设网站查询平台
  • 网站的后台是开发做的社会化媒体营销
  • 厦门seo排名优化公司黄山seo推广
  • 怎么采集网站内容沈阳cms模板建站
  • 手机响应式网站怎么做自媒体服务平台
  • 网站风格对比信息表百度链接提交入口
  • 上海 做网站惠州seo计费管理
  • 凡客手机网站怎么建设无锡谷歌优化
  • 家居网站建设方案免费数据统计网站
  • 郑州网站建设公司qq营销软文范文
  • 上海网站建设公司介绍百度付费问答平台
  • 天河区网站建设基础建站如何提升和优化