在界面传来
ID
protected void Button1_Command(object sender
, CommandEventArgs e
)
{
int id
= Convert
.ToInt32(e
.CommandArgument
.ToString());
Response
.Redirect("updated.aspx?id=" + id
);
}
在ui界面接收数据
```csharp
先获取一个数据
public static RoomInfo GetOne(int id
)
{
return RoomInfoDAL
.GetOne(id
);
}
public static VIP getone(int id
)
{
string sql
= "select * from VIP where VIP_ID =" + id
;
DataTable dt
= DBHelper
.ExcuteTable(sql
);
if (dt
.Rows
.Count
> 0)
{
VIP model
= new VIP();
model
.VIP_ID
= Convert
.ToInt32(dt
.Rows
[0]["VIP_ID"]);
model
.VIP_name
= dt
.Rows
[0]["VIP_name"].ToString();
model
.Sex
= dt
.Rows
[0]["Sex"].ToString();
model
.Pid
= dt
.Rows
[0]["Pid"].ToString();
model
.Tel
= dt
.Rows
[0]["Tel"].ToString();
model
.Rzjl
= dt
.Rows
[0]["Rzjl"].ToString();
model
.R_id
= Convert
.ToInt32(dt
.Rows
[0]["R_id"]);
model
.Remark
= dt
.Rows
[0]["Remark"].ToString();
return model
;
}
return null;
}
对数据进行绑定
1.文本框的绑定
控件id
.Text
= model
.model元素名字
;
2.下拉列表的绑定
控件
.SelectedValue
= model
.绑定的元素ID
.ToString();
数据不可选中
控件id
.Enabled
= false;
转载请注明原文地址: https://lol.8miu.com/read-1946.html