protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
BulletedList list = e.Row.FindControl("BulletedList1") as BulletedList; DataRowView drv = e.Row.DataItem as DataRowView; using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
{
SqlCommand cmd = conn.CreateCommand();
string[] sArray = drv["idList"].ToString().Split(',');
string ss = string.Empty;
foreach (string s in sArray)
{
ss += "'" + s + "',";
} ss = ss.Substring(0, ss.Length - 1); cmd.CommandText = "select name from Table2 where id in (" + ss + ")";
conn.Open();
SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
while(reader.Read())
list.Items.Add(new ListItem(reader.GetString(0))); }}
解决方案 »
- 向wuyq11 提问,请问如何用代码配置IIS 谢谢
- 一个关于asp 的问题
- 用ajax修改数据库状态后,当用户刷新页面的时候如何如何保持js修改后的状态。
- 我很想知道这个界面布局是怎么做的?高手们你们会吗?
- 自动生成扩展名为aspx的出现乱码 生成HTML扩展名的 却不会出现乱码 怎么回事 送分
- ASP.NET中如何实现<input type="file" >的“浏览”变成图片按钮?
- 如何關閉模式對話框?
- datagrid的更新问题??得不到修改后的值,也不能更新?
- 站内整站搜索
- asp.net中怎样保持会话变量。
- 火狐支持JS读取XML怎么做?
- 在ASP.net 中如何向 reportview 添加图像
怎么可以放多个id到一个字段中把id字段中的数据截取出来,用in查询