GridView edit validation, edit dropdown list, delete popup confirm

G

Guest

Dear all,
I want to add the function to gridview
1.) when edit mode, the textbox can validate before edit, e.g. if the fields
is required field, user need to fill in something before edited

2.)some field are bound with drop-down list value(get from db), when it is
edited, it can be drop-down list

3.) when user clicks delete, popup a javascript box to comfirm, before delete
 
W

Wiktor Zychla [C# MVP]

1.) when edit mode, the textbox can validate before edit, e.g. if the
fields
is required field, user need to fill in something before edited

use TemplateField with a TextBox and a RequiredFieldValidator linked to it.
2.)some field are bound with drop-down list value(get from db), when it is
edited, it can be drop-down list

again, use TemplateField with a DropDownList which has DataSource and
SelectedValue properties set accoding to the item beeing edited.
3.) when user clicks delete, popup a javascript box to comfirm, before
delete

inject a client-side script into the button's "onclick" attribute to prevent
posting back.

if ( !window.confirm( "Are you sure that you want to delete selected
item?" ) ) return false;

Regards,
Wiktor Zychla
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top