Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Dynamic ConfirmButtonExtender?

$
0
0

Is it possible to have a single generic ConfirmButtonExtender (and ModalPopupExtender)?

I have a page with variuos goodies (Accordion, GridViews, FormViews, etc) and want to be able to invoke the ConfirmButtonExtender from linkbuttons that may be located anywhere on the page. In theory this should work by changing the TargetControlID of both the ConfirmButtonExtender and ModalPopupExtender in code behind when I click one of the linkbuttons.

However, I have a LinkButton ("myLB") that is located in the EmptyDataTemplate of one of my GridViews. When I click on it, I get an error because the TargetControlID cannot be found (presumably because the Confirm and Modal are not located inside the EmptyDataTemplate).

I believe that the TargetControlID property is of String type, and when I pass the LinkButton's ID, I get the error.

I have tried various ways of doing this, but am really struggling. The code sample below is not perfectly dynamic (because I am referencing the specific [linkbutton] control in the code, but even this doesn't work)

protected void GetConfirmation(object sender, EventArgs e)
        {
            LinkButton myLinkButton = (LinkButton)sender;
            ConfirmButtonExtender1.TargetControlID = ((LinkButton)gv_PH.Controls[0].Controls[0].FindControl(myLinkButton.ID)).ToString();
            ModalPopupExtender1.TargetControlID = ((LinkButton)gv_PH.Controls[0].Controls[0].FindControl(myLinkButton.ID)).ToString();

        }

Any ideas?

Thanks

 


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>