how to check if checkboxes in datalist is checked?

hi,

i have a checkbox in datalist itemtemplate.

i need to have a validation that checks if theres atleast 1 checkbox in datalist item that is checked, when button delete is click.

Thanks

 

0
someguy198650
9/23/2008 3:41:23 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

2 Replies
583 Views

Similar Articles

[PageSpeed] 40

Here is code to read value of checkbox in datalist control.

foreach (DataListItem item in this.dataListName.Items)
{
                //if check box is an html control
                HtmlInputCheckBox chk = item.Cells[0].FindControl("checkBoxName") as HtmlInputCheckBox;
                //OR if checkbox is server side asp.net control
                CheckBox chk = item.Cells[0].FindControl("chkboxFlag") as CheckBox;

                //to do
}
0
asimiq80
9/23/2008 4:34:12 AM

Hi,

           Make your checkbox as simple HTML control (don't make it runat server)

               <ItemTemplate>

                       <input id="chk" type="checkbox" name="chk" value='<%# Eval("fieldname") %>' />

               </ItemTemplate>

         Now in click of delete button, you can validate atleast  one checkbox is checked using below code.

         if (Request.Form["chk"] == null) {

                 Response.Write("Please select at least one option");

        }

0
vinkesh
9/23/2008 6:01:00 AM
Reply:

Similar Artilces:

checking checkbox is checked or not using checkbox.checked
Hi,my checkbox is<asp:CheckBox ID="Chkcity" runat="server" Text="My own city"  OnCheckedChanged="EventHandler"/>code behind: Private Sub Chkcity_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Chkcity.CheckedChangedif (Chkcity ...............)end if End SubERROR    'EventHandler' is not a member of 'ASP.bpoaddjob_aspx'.    Please Mark the post as "ANSWER" if it helps you I think it should be like this:<asp:CheckBox ID="Chkcity"...

Check All Check Box While Check Header CheckBox
 hello...I have two grid on same page...both grid contains header checkbox and item checkbox i want that if use check header checkbox then all item check box checked,i have javascript for this functinality but problem is that when i click on header check box of first grid then checkbox of second grid also checked that i dnt want i want to perform this operation on one grid at one time.i have attache my script also...plz help me....thanks<script type="text/javascript">        function SelectAll(ID)      &nbs...

Check One CheckBox To Check All CheckBoxes
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked. I set the AutoPostBack property of the CheckBox in the Header to True & am invoking a sub named CheckAllRows on the CheckedChanged event of this CheckBox. The CheckBox in the Header exists within the HeaderTemplate of a TemplateColumn in the DataGrid & the rest of the CheckBoxes reside within the ItemTemplate of the same TemplateColumn. This is the code (the ID of the CheckBox in the Header...

Check In Check Out
I have some source code that I need to modify and it was sent to me in a Registered status. Therfore, when I open any object it says " 'object name' is registered but not checked out and therefore can not be overwritten. Open anyway?" Then when I try to check it out, I get "PBNative checkout not allowed for registered objects." How can I get around this? When I look under the "Source" menu, all the items concerning registered are grayed out. TIA Option1:Copy the object(Only) to someother pbl and try . Option2:If You have any SCC Expo...

Check-in/Check-out
I'm having some difficulty with powerbuilder's check-in/check-out operation. When I check an object back in, the .pbl the object is being moved from is destroyed. Has anyone else experienced this and is there a fix? Cheers, Tom Thomas F. (Tom) Massey wrote: > > I'm having some difficulty with powerbuilder's check-in/check-out > operation. When I check an object back in, the .pbl the object is > being moved from is destroyed. > > Has anyone else experienced this and is there a fix? > > Cheers, > > Tom The prob...

Check out/check in
Hello How can i use the process check out/check in in PowerBuilder 8.0.3 ? We work in network. The Source Control is PB Native. I don't understand what is the parameters of Source Control ? Thank you Have you looked the PB8 User's guide? Chapter 3 talks about source control. -- Evita Chapa Senior Systems Analyst II Command Technologies Inc. <Herv� Bareth> wrote in message news:3f69ba0a.592b.846930886@sybase.com... > Hello > > How can i use the process check out/check in in PowerBuilder > 8.0.3 ? We work in network. The Source Control is PB Na...

Check In/Check out
I am using PowerBuilder 9. The undo check out is right next to the check in. This is a big problem! I so easy to select Undo check out and lose all of your changes. I lost 8 hours of work yesterday because of it. I know I should be more careful. However, there should be a "Are you sure" some where also. PLEASE FIX!!!!!!!!!!!!! -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ This isn't the tech support line, it's an end-user forum. If you want to report a bug, use CaseXpress and either open a case or report a bug ...

Check out/check in
Hello How can i use the process check out/check in in PowerBuilder 8.0.3 ? We work in network. The Source Control is PB Native. I don't understand what is the parameters of Source Control ? Thank you Better to ask this in the source control group. Lots of posts on PBNative -- Evita Chapa Senior Systems Analyst II Command Technologies Inc. <Herv� Bareth> wrote in message news:3f69678e.7b3a.846930886@sybase.com... > Hello > > How can i use the process check out/check in in PowerBuilder > 8.0.3 ? We work in network. The Source Control is PB Native. ...

Checked=Checked
 I am dynamically writing out checkboxes on a page.  I have 2 link buttons on the page that sets a boolean variable to True or False. This boolen is set in Page_PreInit and is used to Select or Deselect all the Checkboxes as they are written out. A Select ALL, Deselect ALL type of thing. At least that is the plan. As the page is being written out I do this for each checkbox and then add it to a table cell control that it added to a table row and on. tc is the table cell.  Dim chkItem As CheckBox = New CheckBox chkItem.ID = "chkRecommend" + drMember("ID")...

Check in
Hi all. I am migrating from PB 7.0 to PB 10.5, After migrating my first application i am trying to work on my first window but i'am not able to find out the way to CHECK it OUT. Wher do i can find "check out/check in" functions ?? TIA Mario Parietti What source control are you using? Have you configured it? Right click on your Workspace and check the source control tab to see if you've got it set up. "Mario Parietti" <mparietti@intercad.ch> wrote in message news:451283e0$1@forums-1-dub... > Hi all. > I am migrating from PB...

Not able to un-check or check my checkbox control using Java Script with .aspx
Hello, I am trying to programatticaly un-check a checkbox on my web form using Java script. This is in an asp.net web form. Can someone spot what is wrong here? Below is the web form that can easily be cut and pasted into visual studio in order for you to see what is going on.   <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Sampler._Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script...

How to check if CheckBox is check in C#
Hi all,Please help.I have  a gridview and inside the <HeaderTemplate> I declare a checkBox as follow: <HeaderTemplate > <asp:Label ID="Label6" runat="server" Text='Code' CssClass="dirStyle1"></asp:Label>&nbsp; <asp:CheckBox ID="CheckBox1" runat="server"/> </HeaderTemplate>so let say i have a button for PostBack/Submit so how do I check if the checkbox is check?I tried ------------------------------------------------------------ CheckBox chbx = GridView1.FindControl("CheckBox1&qu...

if checkbox is checked , then all the checkboxlist should be checked
i have a checkbox list and a checkbox , i want f the checkbox is checked then all the checkboxes in the checkboxlist should be checked as well.   Please suggest , if there is any way out   Thanksneelu gupta Do u want this to be done on the client side or server side? And are these check boxes server controls or html controls??Shravan Addaypally MCP maybe this thread can help.> penny for a thought...

How to check checkbox is checked or not dynamically....
Hai friends.... I am creating checkbox dynamically............ dim check(100) as checkbox dim cell as new tablecell check(i)=new checkbox() is there any short method to check whether non of the checkbox is checked........... Ambrose... Help me......Winners Never QuitQuitters Never Win You could do this to check if check boxes are checked If CheckBox1.Checked Then    Message.Text &= "CheckBox 1 was checked<br/>"  End If  If CheckBox2.Checked Then    Message.Text &= "CheckBox 2 was checked<br/>"  End ...

Web resources about - how to check if checkboxes in datalist is checked? - asp.net.presentation-controls

Quick Tip Friday: Create Checklists Faster with Auto-Checkboxes
/ We know a lot of Evernote users love checkboxes for to-dos, grocery lists, and more. Creating checkboxes in Evernote is easy: you can add them ...

Group sues Michigan secretary of state over citizenship checkboxes for voters
... rights coalition filed a federal lawsuit today in Detroit challenging Secretary of State Ruth Johnson’s decision to have U.S. citizenship checkboxes ...

Evernote for BlackBerry 10 updated with checkboxes, image and audio attachments
Evernote has updated its recently launched app for the BlackBerry 10 platform with new features, alongside speed improvements and two-step verification. ...

Add checkboxes to an Excel spreadsheet
Tgood37 asked the Answer Line forum how to add checkboxes to Excel spreadsheets, and how to make sure that checking a box will have an effect. ...

Solving Twitter and LinkedIn’s Ad Problem: It’s Time to Ditch the Checkboxes
Last week was a big one for social media giants Twitter and LinkedIn. They admitted to their investors and to the world that their display advertising ...

Simple trick for testing forms full of checkboxes with django
... testing style. What matters is that you have tests. Image via Wikipedia But what do you do when you want to test a form with a bunch of checkboxes? ...

Checkboxes that kill your product
Alexander Limi / Alex Limi : Checkboxes that kill your product — (To read this article with its formatting and typography intact, click here) ...

Evernote for BlackBerry 10 updated with checkboxes, image and audio attachments
... 10 platform with new features, alongside speed improvements and two-step verification. Among the new features is the ability to insert checkboxes ...

Bento for iPad for iPad on the iTunes App Store
Read reviews, get customer ratings, see screenshots, and learn more about Bento for iPad on the App Store. Download Bento for iPad and enjoy ...

Facebook Users in Brazil and India Can Syndicate Their Profiles to Orkut
Facebook users in Brazil and India can now connect their profiles with their account on Orkut , Google’s existing social network. Those who link ...

Resources last updated: 12/9/2015 3:16:28 AM