///设置单选
/// </summary>
public void DataGridBoundEvent()
{
for(int i=0;i<dgShouldPay.Items.Count;i++)
{
Label r =(Label)(dgShouldPay.Items[i].Cells[0].FindControl("lbSel"));
if(dgShouldPay.Items[i].Cells[3].Text==null&&dgShouldPay.Items[i].Cells[2].Text=="")
{
r.Text = "<input type=radio name='myradiogroup' value=" + "" + "runat = server>";
}
else
{
r.Text = "<input type=radio name='myradiogroup' value='" + dgShouldPay.Items[i].Cells[2].Text + "'runat = server>";
}
if(i==0)
{
r.Text = "<input type=radio name='myradiogroup' value='" + dgShouldPay.Items[i].Cells[2].Text + "' checked = false runat = server>";
}}}
我用的是模板列,模板列中,放了一个Label.我怎么知道那个扭被选中
/// </summary>
public void DataGridBoundEvent()
{
for(int i=0;i<dgShouldPay.Items.Count;i++)
{
Label r =(Label)(dgShouldPay.Items[i].Cells[0].FindControl("lbSel"));
if(dgShouldPay.Items[i].Cells[3].Text==null&&dgShouldPay.Items[i].Cells[2].Text=="")
{
r.Text = "<input type=radio name='myradiogroup' value=" + "" + "runat = server>";
}
else
{
r.Text = "<input type=radio name='myradiogroup' value='" + dgShouldPay.Items[i].Cells[2].Text + "'runat = server>";
}
if(i==0)
{
r.Text = "<input type=radio name='myradiogroup' value='" + dgShouldPay.Items[i].Cells[2].Text + "' checked = false runat = server>";
}}}
我用的是模板列,模板列中,放了一个Label.我怎么知道那个扭被选中
解决方案 »
- PagerStyle.Mode有哪些枚举值啊。各个值的含义是什么
- 用Dreamweaver做好的asp页面,如何导入到vs中?
- .net
- 地址栏传参的字符串长度是否有限制?
- 请教高手(DotNet2):怎样使DataList容器中的DropDownList(AutoPostBack="true")PostBack后保留所选的值呢?
- 出了300分了哈,不够再开~~~~~~~~
- 求救
- 我有一个比较规范的ASP网页,请问如何移植到ASP.NET上去??有没有这类工具?
- 急,哪个好心人帮帮忙咯!
- 求微软ASP.NET和ADO.NET的最新试例下载!!!UP者有分~
- 我写了一个函数用于截取字符串的,为什么不起作用,帮忙查一下。。。
- 关于用StringBuilder生成静态页面的问题
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<input type=radiobutton runat=server id=rad value='<%#DataBinder.Eval(Container.DataItem,"字段名")%>'>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
取值的时候直接
Request.Form["rad"]就行了,不用像checkbox那样循环判断
页面数据列表控件中的代码:
<ItemTemplate>
<INPUT id="xz" type="checkbox" value='<%# DataBinder.Eval(Container.DataItem,"id") %>' name="xz" runat="server">
</ItemTemplate>===============================
#region Del() 选中删除的函数 /// <summary>
/// 选中删除的函数
/// </summary>
public void Del(object sender, System.EventArgs e)
{
string allid = null;
int i=0;
HtmlInputCheckBox cb;
foreach(DataGridItem di in dg.Items)
{
cb = (HtmlInputCheckBox)di.FindControl("xz");
if (cb.Checked==true)
{
allid += cb.Value+",";
i++;
}
}
if (allid!=null)
{
allid = allid.TrimEnd(',');
AdminClass myClass = new AdminClass();
if (Request.QueryString["state"] == "smallclass")
{
tableName = "smallclass";
}
else
{
tableName = "classList";
}
if(myClass.delTable(tableName,allid))
{
myClass.Dispose();
Function.showerr("删除成功!",Request.Url.Segments[Request.Url.Segments.Length-1] + Request.Url.Query);
return ;
}
else
{
myClass.Dispose();
Function.showerr("删除失败,请返回重新操作!");
return ;
}
}
}
#endregion
================================