前台代码:
1 <asp:Repeater ID="ChangeMajor" runat="server">
2 <ItemTemplate>
3 <tr class="tdl">
4 <td style="width: 40px;">
5 转科<%#Eval("counts")%>.
6 </td>
7 <td style="width: 140px;">
8 <input type="text" id="ChangeDate1" class="DateKJ" value='<%#Eval("FZKDATE")%>' runat="server" />日
9 </td>
10 <td style="width: 110px;">
11 <%--<input type="text" id="ChangeTime1" class="inputshort60" value='<%#Eval("FZKTIME")%>' runat="server" />--%>
12 <select id="ChangeTime" class="inputshort60" runat="server">
13 <option value="0">0</option>
14 <option value="1">1</option>
15 <option value="2">2</option>
16 <option value="3">3</option>
17 <option value="4">4</option>
18 <option value="5">5</option>
19 <option value="6">6</option>
20 </select>
21 时 转
22 </td>
23 <td>
24 <input type="text" id="ClassName" class="inputshort140" value='<%#Eval("FZKDEPT")%>'
25 runat="server" />
26 </td>
27 </tr>
28 </ItemTemplate>
29 </asp:Repeater>
后台代码:
1 String strconn = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
2 protected void Page_Load(object sender, EventArgs e)
3 {
4 string sqlstrzk = " SELECT ROW_NUMBER () over(order by fid) counts,[FID],[InHospitalKey] ,[FPRN],[FTIMES],[FZKTYKH] ,[FZKDEPT],convert(varchar(10),[FZKDATE],121) as [FZKDATE],[FZKTIME] FROM [TSWITCHKS] where FPRN=@FPRN and FTIMES=@FTIMES ";
5 ChangeMajor.DataSource = pds(sqlstrzk, fprn, ftimes);
6 ChangeMajor.DataBind();
7 }
8 public PagedDataSource pds(string sqlstr,string str1,string str2)
9 {
10 SqlConnection con = new SqlConnection(strconn);
11
12 DataSet ds = new DataSet();
13
14 SqlDataAdapter sda = new SqlDataAdapter(sqlstr, con);
15 sda.SelectCommand.Parameters.Add(new SqlParameter("@FPRN", str1));
16 sda.SelectCommand.Parameters.Add(new SqlParameter("@FTIMES", str2));
17 sda.Fill(ds, "name");
18
19 PagedDataSource pds = new PagedDataSource();
20 pds.DataSource = ds.Tables["name"].DefaultView;
21 return pds;
22 }
现在其他的值都可以用文本框显示,但是select标签不知道如何控制?请问如何控制select标签的值从数据库取出显示选中。
- 8 回答
- 0 关注
- 461 浏览
添加回答
举报
0/150
提交
取消