vendredi 2 juin 2017

Changing the Checkbox Value if Default value is Checked

I am using a user control which contains a Datalist and it contains Checkbox which sets the value as Checked based on the Database Value.

Now when I un-check the value of the checkbox and try to retrieve the value and checked property in the parent click event , I get the value to be blank and Checked to be true. I tried to Change onclick and Onchange event but no luck. I have removed the Onchange and Onclick Event Currently in the code.

My code :

<asp:DataList ID="dlAssignTeams" runat="server" DataSourceID="sqldlAssignteam" OnItemDataBound="dlAssignTeams_ItemDataBound">
        <HeaderTemplate>
             <table>    
                           <tr> <br /> <br /></tr>                  
                    <th style='text-align:justify'> TEAMS </th>
                    <th style='text-align:justify' > ASSIGN </th>
                    <th style='text-align:justify'> ISMANAGER </th>                    

        </HeaderTemplate>
        <ItemTemplate>  a Data

                <tr>
                    <td style='text-align:justify'>
                        <asp:Literal Text='<%# DataBinder.Eval(Container.DataItem, "hfteamid") %>' runat="server" ID="tbTeamid" Visible="false"></asp:Literal>

                        <asp:Literal Text='<%# DataBinder.Eval(Container.DataItem, "Teams") %>' runat="server" ID="tbteams"></asp:Literal>

                    </td>

                    <td style='text-align:justify'>                                          

                        <input type="checkbox" class="cbselectall"  runat="server" name="btnassign" id="cbassign" checked='<%# DataBinder.Eval(Container.DataItem,"Teamid").ToString()!="" %>' />
                    </td>
                    <td style='text-align:justify'>
                        <input type="checkbox" class="cbselectnone" checked='<%# DataBinder.Eval(Container.DataItem,"isMgr").ToString()=="True"%>' runat="server" name="btnismgr" id="cbmanager" />

                    </td>
                </tr>             

        </ItemTemplate>
        <FooterTemplate>
            </table>
        </FooterTemplate>

    </asp:DataList>




Aucun commentaire:

Enregistrer un commentaire