Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
769
urgent: webgrid dropdownlist help
posted

Hello all,

I would like to know how to program the following functionalities using a webgrid dropdownlist, I have two scenarios (questions). Please answer to each question stating which question you have the solution to so it's clear for me to follow as well as others who might have the same problem.

Question 1. I have a webgrid that has three columns, column1 contains all processx (p184) and column2 contains the statuses (complete, in progress, or not running) and column 3 contains a list of commands (Remove, Edit and Add).  On each process, depending on the status, I would like to display the respective command list.

Add - add a new process (redirects the user to a new screen)

Remove - removes the current selected record

Edit - edit the current selected record (redirects the user to a new screen)

 For example, if

row1, column1=process5; column2="Inprogress"; column3=(Add),

row2, column1=process6; column2="Completed"; column3=(Remove),

row3, column1=process7; column2="Not Running"; column3=(Remove, Edit, Add)

I would like to do all of this in the cold behind so basically, each row that is being populated onto the webgrid, I would like to determine what command to display. I don't want to use any script or any client side code (if possible).  I've tried some client code with the webgrid and it doesn't work out for me (that means it does not work at all)

Question 2: Assuming that the above question all worked fine, when I select the Remove command from row3

row3, column1=process7; column2="Not Running"; column3=(Remove, Edit, Add)

I would like to remove this record from the database (and dataset as well), what event method in the webgrid do I need to use.

 I know that if I were to use a regular web form (asp.net 2.0) dropdownlist then I would use the SelectedPageIndex_Change or something like that. Basically, when I select the command item from the dropdownlist, I don't want to click on a Submit button in order to remove a record on my webgrid (basically row3 in this case), I just want to remove it from my webgrid. The same goes for the Edit and Add, when Edit or Add is selected, I would like to redirects the user to a new page. In the case of edit, I would grab the progress and status value to the edit screen.  I want to do all of this in the code behind. Please provide sample code of how it should work.  I've posted something similar to this and it was ignored, so please help me out.

Thanks you very much in advance!

HS2