How Do I set TargetControlID of AjaxControl:ModalPopupExtender if the Button belongs to each row of a gridview
In my page i need to build one gridview with some data and at the last column there will be a button. Now in that Button Click I need to have a modal popup window from where I need to take some more data from user. after providing the data if user clicks on submit button then only records belongs to gridview and the modal popup window will move to database.
1. How can I do this ?
2. Before opening Modal popup window I need check certain cell's value of the parent gridview. How to achieve this functionality
There is a trick when using AJAX ModalPopup with GridView and here it is:
1. Create a Label or any other server control that can extend the ModalPopup
2. Use CSS to hide the control: add style="display:none;" to the control's definition markup code (don't use Visible=False to hide it)
3. Set ModalPopup's TargetControlID to the control you added in step 1
How to show the popup?
In your code-behind, after you check the cell's value, just call YourModalPopupID.Show()
amar31282
@prairiedog i think i have implemented the same thing
prairiedog
@amar31282, yes, you are right. My bad. Please scratch out my comment.
1. Create a Label or any other server control that can extend the ModalPopup
2. Use CSS to hide the control: add style="display:none;" to the control's definition markup code (don't use Visible=False to hide it)
3. Set ModalPopup's TargetControlID to the control you added in step 1
How to show the popup?
In your code-behind, after you check the cell's value, just call YourModalPopupID.Show()