Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

[4632] Selecting, Confirming & Deleting Multiple Checkbox Items In A DataGrid (i.e. HotMail & Yahoo)

Last post 12-05-2006 7:02 AM by suhasini51. 57 replies.
Page 4 of 4 (58 items) < Previous 1 2 3 4
Sort Posts: Previous Next
  • 08-08-2005 12:00 PM In reply to

    • ZiggY81
    • Not Ranked
    • Joined on 08-08-2005
    • New Member
    • Points 10

    Checkboxes always false

    I copy pasted the code in this tutorial exactly as they are, however in the server side function when i loop through the datagrid's checkboxes, they are always false (checked=false)!

    What could the problem be? Any ideas?
    • Post Points: 0
  • 08-09-2005 6:44 PM In reply to

    • DMarko1
    • Top 500 Contributor
    • Joined on 09-19-2003
    • Addicted Member
    • Points 45

    That is very strange, as I just copied the code to test it for fun, and I got none of the problems you've encountered. Other than this I really don't see why you would be getting that. This, of course is silly to ask, but something must be checked in order to return a checkbox=true.

    In any event, I have updated methodology found in this article in Part 2, where it covers how to multi-select checkboxes and maintain state across pages with sorting.

    You can find it on DNJ - Selecting, Confirming & Deleting Multiple Checkbox Items In A DataGrid - Part 2: Maintaining CheckBox State Across Pages with Sorting.

    Hope this helps.
    • Post Points: 0
  • 08-09-2005 6:46 PM In reply to

    • DMarko1
    • Top 500 Contributor
    • Joined on 09-19-2003
    • Addicted Member
    • Points 45

    Hey jackLi, I am proud to say that I have tackled this issue and you can find the solution on dotnetjunkies, Selecting, Confirming & Deleting Multiple Checkbox Items In A DataGrid - Part 2: Maintaining CheckBox State Across Pages with Sorting.

    -Jimmy Markatos
    • Post Points: 0
  • 08-09-2005 6:53 PM In reply to

    • DMarko1
    • Top 500 Contributor
    • Joined on 09-19-2003
    • Addicted Member
    • Points 45

    New Multi-Select Checkbox Article - Part II!

    Hello all,

    The article "Selecting, Confirming & Deleting Multiple Checkbox Items In A DataGrid" you may have read here on developerfusion is Part 1 written a while ago, and it covered only a simple example of checking a series of checkboxes within one page on a DataGrid, whereby you could then delete your items, but offered no paging nor any maintaining of state.

    I have recently improved on this in Part 2 of the article, and it demonstrates how to multi-select checkboxes across pages with sorting on a page-by-page basis

    You can find it on DNJ - Selecting, Confirming & Deleting Multiple Checkbox Items In A DataGrid - Part 2: Maintaining CheckBox State Across Pages with Sorting.

    - Jimmy Markatos
    • Post Points: 0
  • 08-22-2005 7:39 PM In reply to

    • DMarko1
    • Top 500 Contributor
    • Joined on 09-19-2003
    • Addicted Member
    • Points 45

    Highlight multi-select checkbox row for Part II

    Hello all,

    Since I have had Part II of my multi-select article published on DNJ, I have now also been able to implement a way to highlight the selected row or entire set of rows and maintain this state across pages just as in my article, with of course the added benefit of showing users which row(s) they've checked, even when they happen the back back.

    You can see the article here - and then go to the forum listing on dotnetjunkies - Selecting, Confirming & Deleting Multiple Checkbox Items In A DataGrid - Part 2: Maintaining CheckBox State Across Pages

    Then view the enhanced code in the forum - Highlight and maintain multi-selected checkbox row colors.

    - Jimmy Markatos
    • Post Points: 0
  • 10-08-2005 9:47 PM In reply to

    • Kaaron
    • Not Ranked
    • Joined on 10-08-2005
    • New Member
    • Points 5
    I am having trouble with the
    Code:
    ClientScript.RegisterClientScriptBlock(Of Boolean, "jsScriptConfirmOption")()[\code]

    I am using asp.net 2.0 and i found your code really useful. Unfortunately i dont know how to translate this one section of it.
    I've changed the use of the code slightly from not having one delete button, but an accept button and a delete button. I need a different action for either button. the accept buttton updates and of couse the delete button deletes. can anyone tell me what the correct syntex
    this is my code...
    Code:
    Sub Page_PreRender(ByVal Sender As Object, ByVal E As EventArgs)
           Dim nl As String = Environment.NewLine
           Dim jsScriptConfirmOption As New StringBuilder()
           With jsScriptConfirmOption

               .Append("<script language=JavaScript>" & nl)
               .Append("<!--" & nl & nl)

               .Append("function confirmDelete (frm) {" & nl & nl)
               .Append(" // loop through all elements" & nl & nl)
               .Append(" for (i=0; i<frm.length; i++) {" & nl & nl)
               .Append(" // Look for our checkboxes only" & nl)
               .Append(" if (frm.elements.name.indexOf ('CHKOption') !=-1) {" & nl & nl)
               .Append(" // If any are checked then confirm alert, otherwise nothing happens" & nl)
               .Append(" if(frm.elements.checked) {" & nl & nl)
               .Append(" return confirm ('Are you sure you want to delete your selection(s)?')" & nl & nl)
               .Append(" }" & nl)
               .Append(" }" & nl)
               .Append(" }" & nl)
               .Append(" }" & nl & nl)

               .Append("function confirmAccept (frm) {" & nl & nl)
               .Append(" // loop through all elements" & nl & nl)
               .Append(" for (i=0; i<frm.length; i++) {" & nl & nl)
               .Append(" // Look for our checkboxes only" & nl)
               .Append(" if (frm.elements.name.indexOf ('CHKOption') !=-1) {" & nl & nl)
               .Append(" // If any are checked then confirm alert, otherwise nothing happens" & nl)
               .Append(" if(frm.elements.checked) {" & nl & nl)
               .Append(" return confirm ('Are you sure you want to accept your selection(s)?')" & nl & nl)
               .Append(" }" & nl)
               .Append(" }" & nl)
               .Append(" }" & nl)
               .Append(" }" & nl & nl)

               .Append("/*Using modified select_deselectAll script function of my original one,")
               .Append(" from Developerfusion.com forum members - ketcapli & thombo")
               .Append(" Forum Post - [http://www.developerfusion.co.uk/forums/topic-22773]*/")

               .Append("function select_deselectAll (chkVal, idVal) {" & nl)
               .Append(" var frm = document.forms[0];" & nl)
               .Append(" if (idVal.indexOf('CHKOption') != -1 && chkVal == true){" & nl)
               .Append(" var AllAreSelected = true;" & nl)
               .Append(" for (i=0; i<frm.length; i++) {" & nl)
               .Append(" if (frm.elements.id.indexOf('CHKOption') != -1 && frm.elements.checked == false){ " & nl)
               .Append(" AllAreSelected = false;" & nl)
               .Append(" break;" & nl)
               .Append(" } " & nl)
               .Append(" } " & nl)
               .Append(" if(AllAreSelected == true){" & nl)
               .Append(" for (j=0; j<frm.length; j++) {" & nl)
               .Append(" if (frm.elements[j].id.indexOf ('CheckAll') != -1) {" & nl)
               .Append(" frm.elements[j].checked = true;" & nl)
               .Append(" break;" & nl)
               .Append(" }" & nl)
               .Append(" }" & nl)
               .Append(" }" & nl)
               .Append(" } else {" & nl)
               .Append(" for (i=0; i<frm.length; i++) {" & nl)
               .Append(" if (idVal.indexOf ('CheckAll') != -1) {" & nl)
               .Append(" if(chkVal == true) {" & nl)
               .Append(" frm.elements.checked = true; " & nl)
               .Append(" } else {" & nl)
               .Append(" frm.elements.checked = false; " & nl)
               .Append(" }" & nl)
               .Append(" } else if (idVal.indexOf('CHKOption') != -1 && frm.elements.checked == false) {" & nl)
               .Append(" for (j=0; j<frm.length; j++) {" & nl)
               .Append(" if (frm.elements[j].id.indexOf ('CheckAll') != -1) { " & nl)
               .Append(" frm.elements[j].checked = false;" & nl)
               .Append(" break; " & nl)
               .Append(" } " & nl)
               .Append(" } " & nl)
               .Append(" } " & nl)
               .Append(" } " & nl)
               .Append(" } " & nl)
               .Append(" } " & nl & nl)
               .Append("//--> " & nl & nl)
               .Append("</scr" & "ipt>")
           End With

           'Allows our .NET page to add client-side script blocks when page loads,
           ' instead of the conventional HTML JS tags.

           If (Not ClientScript.IsClientScriptBlockRegistered("clientScript")) Then
               ClientScript.RegisterClientScriptBlock(Of Boolean, "jsScriptConfirmOption")()
           End If
           jsScriptConfirmOption = Nothing

       End Sub


    • Post Points: 0
  • 10-11-2005 8:57 PM In reply to

    javascript not a member of...

    I am using your code for VB, and I am getting an error on complie.  I had to change the OnClick to OnCheckedChanged because there is no OnClick for checkbox.  Anyway, when I compile I get the error:

    BC30456: 'javascript' is not a member of  ASP.Main_aspx.

    Can you advise of how to resolve this error.  Getting the checkbox working is one of the last things I need to do for this application.  I would like to give the users the ability to check all boxes with one click.

    Thanks!
    Holly
    • Post Points: 0
  • 10-11-2005 10:54 PM In reply to

    • DMarko1
    • Top 500 Contributor
    • Joined on 09-19-2003
    • Addicted Member
    • Points 45
    Hi,

    I ran the code and it works as it should. Your error is strange as I don't get that. You are running he latest .NET version, etc? As this would be my guess off the top, or your .NET engine has issues. Try running aspnet_regiis -i, and see if that helps in anyway.

    Hope this helps.
    • Post Points: 0
  • 11-02-2005 8:34 PM In reply to

    • ttvan01
    • Not Ranked
    • Joined on 11-02-2005
    • New Member
    • Points 10

    javascript not a member of...

    I get the same javascript error.  Tried running aspnet_regiis -i, but that didn't do the trick.  did anyone else get this same error, if so how did you resolve it?
    • Post Points: 0
  • 11-03-2005 4:02 PM In reply to

    multi check box in VB

    I don't know if anyone got through this error.  I was not able to fix the issue with the regiis suggestion either.  I just took out the ability to click on box to select all and made the user select each box.  It works for what we need, even if it is not the best answer.  I had to have the application out prior to report cards, which meant it had to be tested and deployed last week.
    • Post Points: 0
  • 11-03-2005 5:29 PM In reply to

    • ttvan01
    • Not Ranked
    • Joined on 11-02-2005
    • New Member
    • Points 10
    Holly10sun,

    Can i ask what you did to get the selecting of each box to work?  I also removed the Select All option, by removing the onclick/OnCheckedChanged  from the HTML, but that alone didn't do the trick.  When tracing through the code, i noticed that although a checkbox is checked, the Checkbox.check in the GetCheckBoxValues() method always return false.

    any help is appreciated.

    thanks~
    • Post Points: 0
  • 04-25-2006 9:56 PM In reply to

    • Shafiqm
    • Not Ranked
    • Joined on 04-25-2006
    • Canada
    • New Member
    • Points 5

    Re: [4632] Selecting, Confirming & Deleting Multiple Checkbox Items In A DataGrid (i.e. HotMail & Yahoo)

    I like your article regarding checkboxes. I have very interesting situation, can you please help me how I can solve this.

    My Gridview contains a template column which contains a checkboxlist control. Each row can have multiple checkboxes depening upon the data.

    e.g  (ALL, Code1, Code2, Code3 are checkboxes)

    Row1        ALL       Code1    Code2

    Row2        ALL       Code1

    Row3        ALL        Code1   Code2   Code3

    How can I make sure that for each row, if user selects all the codes then ALL checbox will be automatically be checked and if only one code checbox is checked then ALL should not be checked. Please Guide, How I can achive this

    Thanks

    Shafiq

    • Post Points: 5
  • 12-05-2006 7:02 AM In reply to

    Re: datagrid having multiple checkboxes with confirm d

    Hi,

      I required the same concept as in yahoomail.i am getting checkall and uncheckall in the grid.if all the items in the grid manually is checked then automatically the header checkbox should check.It is also completed.It's working fine.I took html checkboxes both in header and item level to call javascript functions so while deleting the id of that checkboxes is not coming in code behind to delete.if i take asp checkboxes,javascript function is not calling.And also i saw in most of the sites for asp checkbox there is onclick event calling javascript function but i am getting oncheckedchanged event only and not able to call javascript function in that.Please help me regarding this....

    • Post Points: 5
Page 4 of 4 (58 items) < Previous 1 2 3 4