473,793 Members | 2,974 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display Ok/Cancel Message in gridview template(check Box).

26 New Member
Hi,
I am using Grid View Template field(Check Box) for delete a row, but i need a message box(OK/Cancle) should display before deleting the row.My C# Code like this for deleting the row when we click on check box of grid view.

protected void CheckBox2_Check edChanged(objec t sender, EventArgs e)
{

CheckBox chk = (CheckBox)sende r;
GridViewRow row = (GridViewRow)ch k.NamingContain er;
if (chk.Checked == true)
{
string str = Convert.ToStrin g(row.Cells[3].Text).Trim();
string str1 = Convert.ToStrin g(row.Cells[4].Text).Trim();
string str2 = Convert.ToStrin g(row.Cells[6].Text).Trim();
string StrSql = "Update AppointmentMast er set status='" + 0 + "' where LastName='" + str + "' and FirstName='" + str1 + "' and dob='" + str2 + "'";
int intResult = ObjDat.ExecuteS QL(StrSql);


string Appdel = "select * from AppointmentMast er where Status='"+1+"'" ;

DataSet ds = objDAL.GetInfo( Appdel);

GridView1.DataS ource = ds;
GridView1.DataB ind();

}

}

And my Js function for displaying message like this

function MsgOkCancel()
{

var fRet;
fRet = confirm('Are you sure?');
alert(fRet);

if(fRet==true)
{
;
//alert("done")
}
if(fRet==false)
{
//alert("not done")
}


}

But i am not able to combine these two that is When i select the Check Box in Grid View the js function shoud call. Please help me to solve this problem.
Aug 11 '07 #1
3 2713
kenobewan
4,871 Recognized Expert Specialist
Have you tried attributes.add( )?
Aug 11 '07 #2
Shaileshsharma
26 New Member
yes i have tryed attribute .add like this

controlname.att ribute.add("Nam e of JS function") but it is not working
Aug 12 '07 #3
kenobewan
4,871 Recognized Expert Specialist
Usually the syntax is attribute.add(" event","functio n name"). HTH.
Aug 12 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
25366
by: Padam Jain | last post by:
i m populating some records by using DataGrid and i have put delete option as item template. now on click of delete i want to popup confirm message box. Please provide me solution. its very urgent Padam
9
31246
by: yezanxiong | last post by:
Hello all, I am new in asp.net developer,I would like to ask a simple question. how to display a message box in web application using asp.net? If I just use Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click MsgBox("please enter the correct user name and password",
1
6817
by: LittleCheeseburger | last post by:
Hi, For my 'On No Data' event I have the following code: Private Sub Report_NoData(Cancel As Integer) On Error Resume Next MsgBox "There is no data available for your selections.", vbInformation, "No Data Available..." Cancel = True
3
7811
by: Northern | last post by:
I need to write code clear the display box of my DropDownList (something like clear current selected item) while still keep the loaded item list in the DropDownList. I tried DropDownList's ClearSelecttion() method and set SelectedIndex to -1 but neither works. How should I do this? Thanks
7
3115
by: Grey | last post by:
how to design confirm message box, like Javascript Confirm box, in ASP.NET?? if the user click "YES" in the confirm box, i need to do something, else do other things. Do I need to have javascript confirm box or ASP.NET has such feature?? Million thanks.
2
3759
by: Mike Moore | last post by:
asp.net app - How do you get Java-side code to communicate with server-side code? I have tried numerous ways and examples, but have been unsuccessful. Therefore, unless I get real lucky and find another way of doing a messagebox, none of the existing ways will work with the code we have already written. Most all of the message box examples that I have found had the message box code being executed behind a button, which triggers a...
1
2090
by: jbsfe | last post by:
I have a table used to enter the last date a project was updated. When updating via a form, I need to compare the new date against the last date in the record. If the difference is greater than 14, I need to display a message box alerting the user. Secondly, they must then enter comments in the comment field explaing the varience. I'm not sure how to get the last value and compare it to the current value.
3
2228
by: CedricCicada | last post by:
Greetings! I have just returned to C++ after a couple of years in the FoxPro and C# worlds. I am trying to adapt and expand existing code. For debugging and just plain understanding the code I'm working with, I'd like to put little message boxes into the code. It seems a pain to declare a character array, write my message into it, and then call AfxMessageBox() to dispaly it. It seems to me that it would be easy to create a...
2
1196
by: rhepsi | last post by:
hi... i have a value in text box of form 1, and no. of rows in form 2... if value of textbox is graeter then no. of rows in form 2.... then i have to display a message box in form 2... plz help me/.....
0
10430
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10159
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9033
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3719
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2917
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.