SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2005
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Deleting Multiple Records for DataGrid using Checkboxes...!!!

    Hello,

    I want to delete multiple record using checkboxes from my datagrid using c# asp.net , what should i do, are there any script and all to delete the record, i am not getting the exact solution to do this work, can any body suggest or provide me the solution.


    Regards
    Amrat Nandlal

  2. #2
    SitePoint Wizard
    Join Date
    Jan 2005
    Location
    Denmark
    Posts
    1,222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very brief (no time - must buy presents):

    Put a CheckBox control in an unbound column of the datagrid.
    In the click event handler for the "delete" button, iterate through the items/rows of the datagrid. For each item call FindControl to locate the specific instance of the checkbox. Cast to CheckBox and check the Checked value. If Checked inspect the item to retrieve values for parameters for a delete database command.
    /mouse

  3. #3
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hello,

    i want to delete record on multiple selection of checkboxes, i have this code but didnt get any result, if you have any solution then please reply either on my mail address : sukh288gill@yahoo.com or here.


    public void DeleteStore(Object sender, EventArgs e)
    {

    string dgIDs = "";
    bool BxsChkd = false;

    foreach (DataGridItem i in myGrid.Items)
    {

    CheckBox deleteChkBxItem = (CheckBox)i.FindControl("DeleteThis");

    if (deleteChkBxItem.Checked)
    {

    BxsChkd = true;

    dgIDs += ((CheckBox)i.FindControl("DeleteThis")).Text.ToString() + ",";
    Response.Write(dgIDs);
    }

    }



    <ItemTemplate>
    <asp:CheckBox ID="DeleteThis" Text='<%# DataBinder.Eval(Container, "msg_id") %>' runat="server"/>
    </ItemTemplate>

    <asp:Button Text="Delete Items" OnClick="DeleteStore" ID="Confirm" runat="server" />



    sukh

  4. #4
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi friends,

    i have two queries

    1. select * from table1 where pcat=101 order by catid;

    2. select * from table2 where cat=catid order by id limit 1;


    i want to join these two queries

    i have already used its join queries

    SELECT * FROM table2 ps inner join table pc on pc.catid=ps.cat where pcat=101 group by ps.title order by ps.id desc";


    it returns not accurate ans. i want the latest entry if that title order by id but it gives me the first record of that particular title if i m using group by title.


    what do i do if any suggestion please your most welcome
    its urgent please reply me fast

    thanks
    sukh


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •