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
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…
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..
}
}
}
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();
[B] 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..[/B]
}
}
}