开发者

CheckBox selection area

开发者 https://www.devze.com 2023-02-21 05:40 出处:网络
I have an <asp:ComboBox> filled with <asp:CheckBoxes>. The Combobox is 200px wide. The Checkboxes are also 200px wide.

I have an <asp:ComboBox> filled with <asp:CheckBoxes>. The Combobox is 200px wide. The Checkboxes are also 200px wide.

I can check the checkbox only if I click on 'box' or the checkbox text label. I want to be able to check the item even when I click anywhere on the row.

Is there any way to extend this area to the whole row?

update:

CheckBox selection area

On the green area, everything is fine. But on the red area when i click, checkbox is not checked and drop downlist goes up.

<telerik:RadComboBox runat="server" EnableTextSelection="false" 
                     ID="rcb_Something"
                     Width="200px"
                     Hig开发者_如何转开发hlightTemplatedItems="true"
                     AllowCustomText="true"
                     Text="Select Something"
                     MaxHeight="250px">
                     <ItemTemplate>                                                               
                          <telerik:RadBinaryImage ID="RadBinaryImage1" runat="server"
                                                  Width="24px" 
                                                  Height="24px" 
                                                  DataValue='<%# Eval("Something") %>' 
                                                  ResizeMode="Fit"  />    

                                                  <asp:CheckBox ID="CheckBox1"
                                                       runat="server"  
                                                       Text='<%# Eval("Something") %>' 
                                                       ToolTip='<%# Eval("SomethingId") %>'
                                                  />



                   </ItemTemplate>                                                                


Do as books say - add to every input field in HTML, a label tag with label.

<label for="male">Male</label> <input type="radio" name="sex" id="male" />

Clicking anywhere on label, will activate this input, same goes for input type=text


Ok, I find solution. I just disabled combobox background with following code.

JavaScript

function StopPropagation(e) { //cancel bubbling e.cancelBubble = true; if (e.stopPropagation) { e.stopPropagation(); } }

aspx

 <div onclick="StopPropagation(event)">



<asp:CheckBox ID="CheckBox1"
              runat="server"  
              Text='<%# Eval("something") %>' 
              ToolTip='<%# Eval("somethingId") %>'
               />
</div>
0

精彩评论

暂无评论...
验证码 换一张
取 消