How to delete the data of the selected checkbox companion in the datalist, thank you

Updated on technology 2024-04-14
19 answers
  1. Anonymous users2024-02-07

    The value of the label in the datalist is not recorded in the viewstate, so after postback, it must be found later.

    But the checkbox can be found by selecting the checkbox, and you can also use hidden for each row to record, after postbacking, you don't have to rebind the datalist line to find the value you want.

  2. Anonymous users2024-02-06

    Write a method to loop through foreach to get the selected checkbox, and bind the ID to the checkbox' runat="server" /

    foreach (datalist item inif (ids !=

    return ids;

    Then call this method when you delete the time, you only need to delete from table where id in the sql statement

  3. Anonymous users2024-02-05

    Hehe, I've always used a js to do this work, and the name of the method in the js is ok when you go to the source code. If you need it, send me the email.

  4. Anonymous users2024-02-04

    The findcontrol method is the id of the control, which is unique, so your loop finds the same name every time"checkbox1"The same goes for the checkbox linkbutton.

  5. Anonymous users2024-02-03

    checkbox chk = checkbox)"checkbox1");There is only 1 ID, and it is fixed. Of course, only one can be deleted.

  6. Anonymous users2024-02-02

    Select:' />

    Here's the backend logic**.

    foreach (datalistitem item in loop data row}

  7. Anonymous users2024-02-01

    In fact, it is to get so checkbox, and then iterate to see which ones are selected, if it is selected, get the id of that one, after traversing, you can get the id of all the selected records, and finally delete it with deleted from table where id in(1,3,5,6,7). Inside the parentheses is the id of the selected row

  8. Anonymous users2024-01-31

    If you delete in bulk, a delete button is written in the event.

    Iterate through all checkboxes and determine if checked

    Then delete all the checked IDs with SQL statements.

  9. Anonymous users2024-01-30

    All controls have a tag property of type object that can store any data, I don't know if you want to delete it in the foreground or in the background.

  10. Anonymous users2024-01-29

    foreach(datalistitem i incheckbox chk="checkbox1") as checkbox

    Then operate.

    Rebind or redirect.

    **There may be errors. Debug and debug by yourself.

  11. Anonymous users2024-01-28

    I won't post the specific**, you can try to find the checkbox with findcontrol, judge whether it is a choice, and then execute the corresponding sql statement, it should be fine.

  12. Anonymous users2024-01-27

    The 0checkbox control is bound to the keywords of the record and the autopost of the checkbox is set to true

    1. Add the event handler change.

  13. Anonymous users2024-01-26

    First, get the ID of the selected data, determine that checked is true or false, if it is true, save this ID, if the ID of the data you selected is 1, 2, 3, 4

    Then delete the statement and write it like this:

    delete from table where id in (1,2,3,4)

    The resulting id can also be saved in an array, and then a for loop can be written, and the sql statement is added.

    For example, string sql="delete from table where id in ("

    for(int i=0;i< arr is that array.

    Then the truncated character is stripped to remove the last comma, because there is an extra one.

    Finally sql+="stands for backbrackets.

    In fact, to put it bluntly, it is to collect the ID of the selected data and put it into SQL statements.

  14. Anonymous users2024-01-25

    listlist = new list();

    for (int i = 0; i < i++)

    Then separate their IDs and delete them using SQL.

  15. Anonymous users2024-01-24

    using ;

    This one seems to be called generic, and I only know how to use it, but I haven't studied it specifically.

  16. Anonymous users2024-01-23

    The method of binding the list in the page load event ** coats a sentence:

    if(!ispostback)

  17. Anonymous users2024-01-22

    js to judge.

    function getallcheckbox(checkall) calls the function onclick= in the checkbox of all"getallcheckbox(this)"

    In the checkbox of each row, name="id"

  18. Anonymous users2024-01-21

    The checkbox in the datalist cannot use events like other checkboxes, it requires you to use the findcontrol method in the program to find the checkbox and manipulate it.

  19. Anonymous users2024-01-20

    Just write SQL statements!

Related questions
7 answers2024-04-14

int sum=0;

for(int i = 0 ;i< -1;i++) assumes that the ID of the datalist is datalist1 >>>More

10 answers2024-04-14

In fact, as early as the previous win7 64-bit flagship version of the ISO system, we have already encountered such a problem, in order to facilitate the use of more Windows users, Microsoft has set up a lot of fonts in our Windows system, what Microsoft Yahei, what Song, what italics, etc., are our more common fonts, but for many users, we usually need to use only a few fonts, Others don't seem to be of much use to us,Then the existence of these redundant fonts can only waste the space of our system,Below,Take the win10 system as an example,To introduce how to uninstall the extra fonts in the win10 system! >>>More

11 answers2024-04-14

If the parent class and word class are in the same table: Change the delete method as follows: >>>More

3 answers2024-04-14

executable file,You can double-click to install it.,Just remember the installation directory and it's OK.,Because you'll need this installation directory later.。 If it is a compressed package, you just need to remember the location after decompression; The following figure shows the contents of the decompressed file; >>>More

9 answers2024-04-14

Adding the Eclipse plug-in is easy, but once you open Eclipse, click Help ->Install New Software....Then click add will come out of an add site window,Here name enter android (just take one yourself),Enter the network address of the plugin in location: >>>More