This is a discussion on Dynamic Content in AJAX Extender within the .Net Development forums, part of the Programming & Scripting category; I have a datalist that contains an imagebutton control. I've added an AJAX confirm button extender to this imagebutton, but ...
| |||||||
|
#1
| ||||
| ||||
| I have a datalist that contains an imagebutton control. I've added an AJAX confirm button extender to this imagebutton, but I want to dynamically change the confirm text depending on the datalist item. My datalist code is:- Code: <asp:datalist ID="dlst_userlist" runat="server" OnItemDataBound="dlst_userlist_ondatabind" OnEditCommand="dlst_remove_user" CssClass="registerform">
<ItemTemplate>
<tr><td valign="middle"><asp:label ID="lbl_username" runat="server" cssclass="dblue8" Text='<%#Eval("full_name") %>' /></td><td valign="middle"><asp:ImageButton ID="img_remove_user" ImageUrl="link_doc_remove1.gif" CommandName="Edit" CommandArgument='<%#Eval("linkref") %>' runat="server" /></td></tr>
<ajaxtoolkit:ConfirmButtonExtender ID="conf_remove_user" runat="server" ConfirmText='Are you sure you wish to remove <%#Eval("full_name") %> from this task?' TargetControlID="img_remove_user" />
</ItemTemplate>
</asp:datalist> Code: e.Item.FindControl("conf_remove_user").confirmtext = "Are you sure you want to remove " & e.Item.DataItem("full_name") & " from this task?" At the moment if you click the button the confirm text is "Are you sure you wish to remove <%#Eval("full_name") %> from this task?" I want it to say "Are you sure you wish to remove Joe Bloggs from this task?" Any ideas how to dynamically change this text? Thanks Last edited by richyrich; May 6th, 2008 at 11:37 AM. Reason: Removed [SOLVED] from title |
|
#2
| ||||
| ||||
| Try creating an instance like so: Code: Dim btnExtender As AjaxControlToolkit.ConfirmButtonExtender
btnExtender = CType(e.Item.FindControl("conf_remove_user"), AjaxControlToolkit.ConfirmButtonExtender) |
|
#3
| ||||
| ||||
| Perfect. It was the ajaxcontroltoolkit.confirmbuttonextender that I didn't know I could do. Solution: Code: Dim btn_extender as AjaxControlToolkit.ConfirmButtonExtender = e.item.findcontrol("conf_remove_user")
btn_extender.ConfirmText = "Are you sure you want to remove " & e.Item.DataItem("full_name") & " from this task?"
|
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |