以下代码没有错误,可以执行,就是radiobutton不能单选了,在客户端有了变化,应该社repeater的作用引起的,怎么能解决呢!??
错误样式http://219.157.180.250
前台:<asp:Repeater ID="face" runat="server">
<itemtemplate>
<asp:radiobutton id="facecon" value='<%# container.dataitem("imageurl") %>' runat="server"/>
<asp:Image ID="faceimage" ImageUrl='<%# container.dataitem("imageurl") %>' runat="server"/>                
</itemtemplate>
</asp:Repeater> 
后台:
public class face'留言中的表情
inherits webpage
protected withevents face as webcn.Repeater
protected withevents radiogroup as webcn.radiobuttonlist
protected withevents faceimage as webcn.image
sub page_init(sender as system.object,e as system.eventargs)
dim conn as new sqlconnection("server=(local);database=news;uid=sa;pwd=3312079")
dim strsql as string
strsql="select imageurl from messageimage order by id"
dim cmd as new sqlcommand(strsql,conn)
conn.open()
dim dr as sqldatareader=cmd.executereader()
face.datasource=dr
face.databind()
conn.close()end sub
end class

解决方案 »

  1.   

    这个没有办法解决.因为像你这种写法,在生成页面之后,控件的ID将自动添加当前行的ID+列ID+控件ID,名称不同了,也无法形成一个组.
    不过,如果在一个行里面的话,那倒是可以实现
    你可把你的单选框换成复选框组试试看.
      

  2.   

    不要使用Repeater控件,而是改用RadioButtonList控件,在后台代码里添加RadioButtonList的项目。
      

  3.   

    注意RadioButtonList控件这几个属性,可以用来调整布局:
         RepeatColumns="ColumnCount"
         RepeatDirection="Vertical|Horizontal"
         RepeatLayout="Flow|Table"