SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2009
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    gridview with checkbox in edit template

    I m using C# asp.net 2.0 visual studio 2005 and oracle database.

    I have one form in which i have a gridview and 1 button.

    I have a query in fetching a particular data from a gridview.
    I have taken one select column in gridview which is a checkbox.
    Also i have many other items in gridview like ticketno,created_by,comment,status etc.
    Now my query is if i m selecting a particular checkbox i want the ticket no. of that row.

    and i have one button in this form so if user selects that particular checkbox and then click on button at that time i want to send mail to that user who created that ticketno.. (means who raised the incident).


    like my form is like ths.

    Button(this is button control)

    Gridview(this is my gridview in which select column is template field which have checkbox)
    select Ticket_Id Created_by Status

  2. #2
    SitePoint Zealot
    Join Date
    Nov 2001
    Location
    RI, USA
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you have a Click handler for the button? When the button is clicked, there will be a handler in your code file. In this handler you can determine the selected row(s).. something like...

    Code Csharp:
    protected void GridView1_MyBtnClick(object sender, EventArgs e)
        {
            foreach (GridViewRow gv in GridView1.Rows)
            {
                CheckBox ChkBxItem = (CheckBox)gv.FindControl("RowLevelCheckBox");
                if (ChkBxItem.Checked)
                {
                 // get the related ticket number
                 string tickNo = ((Label)gv.FindControl("TicketNo")).Text.ToString();
     
                 // put email sending code here..
                }
            }
        }
    in1.com | Bootply - Bootstrap playground

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2009
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by aspapp View Post
    Do you have a Click handler for the button? When the button is clicked, there will be a handler in your code file. In this handler you can determine the selected row(s).. something like...

    Code Csharp:
    protected void GridView1_MyBtnClick(object sender, EventArgs e)
        {
            foreach (GridViewRow gv in GridView1.Rows)
            {
                CheckBox ChkBxItem = (CheckBox)gv.FindControl("RowLevelCheckBox");
                if (ChkBxItem.Checked)
                {
                 // get the related ticket number
                 string tickNo = ((Label)gv.FindControl("TicketNo")).Text.ToString();
     
                 // put email sending code here..
                }
            }
        }
    In which event i have to write this..I didn't get this..Actually the button which i have taken is not in gridview it is separately in the form

  4. #4
    SitePoint Addict kunalraj's Avatar
    Join Date
    Nov 2008
    Posts
    200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by yogita View Post
    In which event i have to write this..I didn't get this..Actually the button which i have taken is not in gridview it is separately in the form
    No issue if you have not taken button in grid view.

    The same code you have to write in button click event.


    Thanks,
    kunalraj

  5. #5
    SitePoint Addict kunalraj's Avatar
    Join Date
    Nov 2008
    Posts
    200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    Hello,

    protected void GridView1_MyBtnClick(object sender, EventArgs e)
    {
    foreach (GridViewRow gv in GridView1.Rows)
    {
    CheckBox ChkBxItem = (CheckBox)gv.FindControl("RowLevelCheckBox");
    if (ChkBxItem.Checked)
    {
    // get the related ticket number
    string tickNo = ((Label)gv.FindControl("TicketNo")).Text.ToString();

    Here you have to write code for connection and from database you have to get email id of user who create incident and then you have to write put email sending code here..
    }
    }
    }


    thanks,
    kunalraj


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
  •