Repeater中 DropDownList如何绑定数据
来源:百度知道 编辑:UC知道 时间:2024/06/19 22:45:52
表Leavewords 中有个字段 isopen 默认值为0,表示-不显示
如何达到 Repeater中的DropDownList控件有两个选项,开启与关闭。
当选择关闭时 将isopen值改为0,
当选择开启时 将isopen值改为1.
显示的时候,要根据isopen的值来显示。
如何达到 Repeater中的DropDownList控件有两个选项,开启与关闭。
当选择关闭时 将isopen值改为0,
当选择开启时 将isopen值改为1.
显示的时候,要根据isopen的值来显示。
for(int i=0;i<Repeater.Items.Count;i++)
{
DropDownList ddl=(DropDownList)Repeater.Item[i].FindControl("DropDownList的ID");
// DataTable tbl=new DataTable();
// ......
//ddl.DataSource=tbl;
// ddl.DataTextFiled="";
//ddl.DataValueFiled="";
//ddl.DataBind();
//上为DropDownList绑定
//同理,可以把字段"isopen"放进一个Label里边,Label 的设置为不显示
Label lbl=(Label )Repeater.Item[i].FindControl("Label 的ID");
ddl.SelectedValue=lbl.Text;
}
代码手写的
有可能有错误
我就不测试了
Repeater绑定DropDownList
<%@ Page Theme="Default" Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="EditIndividualCell.aspx.cs" Inherits="Ajax学习.EditIndividualCell" %>
<asp:C