Showing posts with label wrong. Show all posts
Showing posts with label wrong. Show all posts

Saturday, March 24, 2012

updatepanel and dropdownlist: invalid postback

This just isnt my day, i just took a whole 15 minutes to write down my problem and the stupid site comes up wioth a oops something went wrong (we lost your post)Angry. I'll be real quick on explaining this time then...

If you look here: http://forums.asp.net/t/1112220.aspx

That's what happened to me today, I'm forced to put update panels everywhere so my data keeps displaying on postbacks. I have a drowpdownlist in an updatepanel in a formview with autopostback set to true that triggers the onselectedindexchanged event. I basically just load some info according to the selected item in a css info box there, so no big deal. If I change my selection once, it works fine, however, after that ALL postback events on my page come up with a javascript alert beginning with "Invalid postback or callback." and then tells me to register the data to the event or something like that. I have tried registering for asynchroneous postback, I tried clientscript.registerforeventvalidation... Nothing works.

I read that I had to register for all possible data that could be displayed in my dropdownlist. However, the dropdownlist content is loaded once (when the button to display the formview is clicked) and won't ever change back until the user cancels or reloads another one. so it shouldnt be a problem...

what am I missing? I don't want to turn enabledeventvalidation to false cuz the way my application is built, it would cut out validation from 80% of my pages or so, which isnt cool. I could take out ALL the update panels, but that's not really a good idea either. So please help, any input is appreciated.

Thanks a lot for your time guys.

You can turn off validation for just that one page. You don't have to turn it off for the whole site. Also the cause of this error can be a number of problems from multiple form tags ect. so check everything.


ok now thats kinda rough... I tried turning the event validation to off for just the page... and now no matter what I do, I can't seem to get my dropdownlist to fire its selectedindexchanged event anymore. I tried adding the event handler in the page load, I tried moving the handler in the code, I turned the validation back on. Nothing works anymore...

I made a small test by moving the dropdown outside of the formview. It works -_-' (ok so i get a bunch of object reference not set to an instance of an object because of how i was getting the reference to my dropdownlist in the formview (findcontrol...), but the event is fired.) Knowing it worked before this morning, even though i was getting this error, what in the world happened? I tried

protected void Page_Load(object sender, EventArgs e)
{
//...
if (MultiView1.ActiveViewIndex == 0 && fvAddEditCat.CurrentMode == FormViewMode.Insert)
{
//add the event handler to the ddl DropDownList ddl = (DropDownList)fvAddEditCat.FindControl("ddlCategories");
ddl.SelectedIndexChanged +=new EventHandler(ddlCategory_SelectedIndexChanged);
}
}

protected void ddlCategory_SelectedIndexChanged(object sender, System.EventArgs e)
{
LoadCategoryInfo();
}

protected void LoadCategoryInfo()
{ ... }


and here is the markup of the formview and the insertitemtemplate

<asp:FormView ID="fvAddEditCat" runat="server"
DataKeyNames="Data_Element_Category_Id" DataSourceID="odsDataElemCat"
DefaultMode="Edit" OnItemInserting="fv_ItemInserting" Visible="false"
OnItemCommand="fv_ItemCommand" OnItemInserted="fv_ItemInserted"
EnableViewState="False" OnItemUpdated="fv_ItemUpdated">
<InsertItemTemplate>
<table class="DataEntryForm">
<tr class="DataEntryTitle">
<td colspan="2">
Data Element Category
</td>
</tr>
<tr>
<td>
<span style="color:Red;">*</span>Category
</td>
<td>
<ajax:UpdatePanel ID="upnl2" runat="server" UpdateMode="Conditional"><ContentTemplate>
<asp:DropDownList ID="ddlCategories" runat="server" AutoPostBack="true" />
<a href="#" class="info"> ? <span class="info" style="width: 320px;">
<table>
<tr>
<td>
Description:
</td>
<td><asp:Label ID="lblCatDesc" runat="server" /></td>
</tr>
<tr>
<td>
Memo:
</td>
<td><asp:Label ID="lblCatMemo" runat="server" /></td>
</tr>
<tr>
<td>
Status Code:
</td>
<td><asp:Label ID="lblCatStatusCode" runat="server" /></td>
</tr>
<tr>
<td>
Creation Date:
</td>
<td><asp:Label ID="lblCatCreateDate" runat="server" /></td>
</tr>
</table>
</span></a>
</ContentTemplate></ajax:UpdatePanel>
</td>
</tr>
<tr>
<td>
Memo
</td>
<td>
<asp:TextBox ID="txtMemo" runat="server" TextMode="multiline" Columns="40" rows="3" text='<%# Bind("Data_Element_Category_Memo")%>'/>
</td>
</tr>
<tr>
<td style="width: 150px;"><span style="color:Red;">*</span>Status Code:</td>
<td style="width: 200px;">
<asp:TextBox ID="txtStatusCode" runat="server" Text='<%# Bind("Status_Code")%>' />
<asp:RangeValidator id="RangeValidator2" runat="server" controlToValidate="txtStatusCode"
ErrorMessage="Data Element Category Sstatus Code must be a number between 0 and 255, or nothing."
Display="Dynamic" CssClass="MsgVal" ValidationGroup="EditDEC" MinimumValue="0" MaximumValue="255" Type="Integer" />
<asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server" controlToValidate="txtStatusCode"
ErrorMessage="Status Code must be entered."
Display="Dynamic" CssClass="MsgVal" ValidationGroup="EditDEC" />
</td>
</tr>
</table>
<asp:Button ID="btnInsert" runat="server" CommandName="Insert" Text="Insert" ValidationGroup="EditDEC" />
<asp:Button ID="btnCancel" runat="server" CommandName="Cancel" text="Cancel" CausesValidation="false" />
</InsertItemTemplate>
note that it all worked until i added that dropdownlist event and had to wrap the ddl and the label into their own updatepanel because otherwise the postback would clear the update panel it was into.

the event name is still in the onselectedindexchanged in the markup... I don't have any secondary form tags or the likes... All I have is a serious feeling that formviews are more trouble than they seem to be useful. I built a few forms with the same kind of functionality before (without the formview) and although the object assignation from all the textboxes is tedious, it works and i don't get stupid ajax errors amd i dont lose my events all the time.

I'm goign to try to remove the event handler and the update panel and rework it from scratch... i've had to do that with another control I worked on and "ajaxified", and if it still doesn't work, I'll probably just give up and use a normal form, unless someone here comes up with the miracle answer im looking for.

Thanks for trying to help.


I think I need vacations... This was too simple a change so i could think of it before now (15 minutes before I wouldve decided to go back to the normal form). Basically, I have the formview static on the page, however, its set to invisible on the first page load, and is only made visible through a button click. However, when I change the dropdownlist index, this button is not clicked again, and so, even if the formview's insert template stays there thanks to the update panel, the code doesnt think it exists. The result: the dropdownlist's event handler is nothing then too. Now, on to how I fixed it? I called the function that shows the form on the page_load when the mode is on insert.

Talk about losing my time on stupid problems... Once again, thanks for trying to help ^^ (I still don't know how it worked before, and what exactly was causing this ajax error... but it works now so lets just hope i never come accross it again)

Wednesday, March 21, 2012

UpdatePanel and ModalPopupExtender control

Hello all

For my error messages I'm using a ModalPopupExtender with a red background to show the user has done something wrong.
If for example the user types in a bad username/password combination, it does a postback and after that it shows me the ModalPopup.

This works fine!

But I want to use the UpdatePanel control of course to make it more smooth, nicer and application alike.

When I put the ModalPopupExtender and Panel (both are on my masterpage) in an UpdatePanel like this:

<ajax:UpdatePanel id="myUpdatePanel" runat="server">
<ContentTemplate>

<toolkit:ModalPopupExtender ID="errorModalPopup"
runat="server"
TargetControlID="btnHidden"
PopupControlID="ErrorPanel"
CancelControlID="btnApply"
DropShadow="true"
BackgroundCssClass="ErrorModalPopupClass"
BehaviorID="test2">
</toolkit:ModalPopupExtender>

<asp:Panel ID="ErrorPanel" runat="server" CssClass="ErrorPanelSettingsClass" Style='display:none' DefaultButton='btnApply'>
<asp:Label ID="lblErrorMessage" runat="server"></asp:Label><br />
<asp:ImageButton ID="btnApply" ImageUrl="~/Images/icons/apply.png" runat="server" CssClass="ApplyButton" />
</asp:Panel>

<div style='display: none'>
<asp:Button ID="btnHidden" runat="server" />
</div>

</ContentTemplate>
</ajax:UpdatePanel>

When I now put my Login Control on my Login.aspx page also into an UpdatePanel, it doens't work as expected. When I click the Login button, nothing happens...

Does anybody know how to achieve this? I really like this solution.

thx !

Gerrie

Please try your scenario with the recently available61106 release of the Toolkit (and ASP.NET AJAX Beta 2). If the problem persists, then please reply with acomplete, self-contained sample page that demonstrates the problem so that we can investigate the specific behavior you're seeing. Thank you!

David,

I don't know if you finally got the sample you needed or not. But so you know, I do have the latest update to the toolkit. However I can't get the modalpopup and updatepanel to work together properly. And that's not to mention the funny issue of the popup sometimes showing up automatically and without being triggered from the code. I saw others had that problem, too.

Anyways, here is a self-contained test page for you. It is based on some code initiallyborrowedfrom Ted Glaza, changed to VB, then AJAX, then simplified and then changed to fit this sample! :)

Any solution or workaround you can provide me with, is highly appreciated. I'm already in a time crunch and don't have the luxury of playing around with these controls. By the way, in real life,my popup control has to be launched from imagebuttons in a DataGrid. All are created on the server-side and I can't change that design easily.

Thanks,

Kathy

<%

@.PageLanguage="VB" %>

<%

@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="ajaxToolkit" %>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

scriptrunat="server">ProtectedSub CommandButton_OnSelect(ByVal senderAsObject,ByVal eAs CommandEventArgs)Dim IDAsInteger =CInt(e.CommandArgument)Dim xAs System.Xml.XmlNode = Data.GetXmlDocument.SelectSingleNode(String.Format("descendant::item[@.id='{0}']", ID))IfNot IsNothing(x)Then

myDynamicLabel.Text =

"The URL is: " & x.Attributes("url").ValueElse

myDynamicLabel.Text =

"Item with ID: " & ID.ToString &" could not be found."EndIf

ModalPopupExtender.Show()

EndSub

</

script>

<

htmlxmlns="http://www.w3.org/1999/xhtml">

<

headrunat="server"><title>Untitled Page</title><styletype="text/css">

/*Modal Popup*/

.modalBackground

{background-color:Gray;filter:alpha(opacity=70);opacity:0.7;

}

.modalPopup

{background-color:#FFF8C6;border-width:3px;border-style:solid;border-color:Gray;padding:3px;width:350px;

}

</style>

</

head>

<

body><formid="form1"runat="server"><asp:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering=true/><p>

Some nonsense text to show the postback. blah di blah.

kjdhfjkh ksdhhsdfhj haunnsdju urfh kjhdjkf kjhdflgkh hr ujseopop';ui;j m[plio;l hjyryawre ghvnb mdfb jyutet ihe lijj huhiut hiuhvnmx mnbuyteruy gwerbmbnhfghtf jhel/krtjk ih banvdhtsfr cvnhfhtfd wklieth bnhdchzgf dejhfgkuhgr jwhg

lusyfiuysdkj jutyujefg jgdfjhg hjdgfhjg dkjf jkhgdsf uytser bvioy yhsejehyj mjnbcvjytyue rvkiuyd h j vihbrtkj f

</p><p>

Some nonsense text to show the postback. blah di blah.

kjdhfjkh ksdhhsdfhj hak kkfguhe mndfgkjh dkjg hzsnmbrtulk typi ,bngf aytwr eb mbhjvu ;orijnjm BFMhbmhdfbv ghvme hjmhg fbmbmnb mnbz

unnsdju urfh lusyfiuysdkj jutyujefg jgdfjhg hjdgfhjg dkjf jkhgdsf uytser bvioy yhsejehyj mjnbcvjytyue rvkiuyd h j vihbrtkj f

</p><p>

Some nonsense text to show the postback. blah di blah.

kjdhfjkh ksdhhsdfhj haunnsdju urfh lusyfiuysdkj jutyujefg jgdfjhg hjdgfhjg dkjf jkhgdsf uytser bvioy yhsejehyj mjnbcvjytyue rvkiuyd h j vihbrtkj f

</p><asp:XmlDataSourceID="Data"runat="server"><Data><items><itemid="1"name="ASP.NET"url="http://msdn.microsoft.com"/><itemid="2"name="AJAX"url="http://ajax.asp.net"/><itemid="3"name="AJAX Control Toolkit"url="http://ajax.asp.net/ajaxtoolkit"/></items></Data></asp:XmlDataSource><!-- If you start the UpdatePanel here, clicking the links won't work -->

<!-- Databound list of LinkButtons that fire server side Command events passing in their ID --><asp:DataListID="List"runat="server"DataSourceID="Data"><HeaderTemplate>Microsoft Web Development Technologies:</HeaderTemplate><ItemTemplate><asp:LinkButtonID="CommandButton"runat="server"Text='<%# Eval("name") %>'CommandName="Select"CommandArgument='<%# Eval("id") %>'OnCommand="CommandButton_OnSelect"/></ItemTemplate></asp:DataList><!-- If you start the UpdatePanel here, you need some ControlID for the trigger.

Try CommandButton and you get an error that it doesn't exit.

Try List and the popup doesn't show.

What else?!

You can set it to something totally unrelated, like btnTest for the popup to work

or you can remove the UpdatePanel altogether, since it's no good anyways...

-->

<asp:UpdatePanelID="UPPnl"runat="Server"UpdateMode="Conditional"><ContentTemplate><asp:PanelID="Panel1"runat="server"width=630CssClass="modalPopup"style="display:none">

<asp:LabelID="myDynamicLabel"runat="server"></asp:Label>

<asp:ButtonCssClass="command"ID="Cancel"runat="server"Text="Cancel"CausesValidation="False"/></asp:Panel></ContentTemplate><Triggers><asp:AsyncPostBackTriggerControlID="btnTest"/></Triggers></asp:UpdatePanel>

<ajaxToolkit:ModalPopupExtenderID="ModalPopupExtender"runat="server"TargetControlID="btnTest"PopupControlID="Panel1"BackgroundCssClass="modalBackground"DropShadow="true"OkControlID="Cancel"CancelControlID="Cancel"/><br/><br/><asp:ButtonID="btnTest"runat="server"Text="Don't Click Me!"/></form>

</

body>

</

html>


David,

I don't know if you finally got the sample you needed or not. But so you know, I do have the latest update to the toolkit. However I can't get the modalpopup and updatepanel to work together properly. And that's not to mention the funny issue of the popup sometimes showing up automatically and without being triggered from the code. I saw others had that problem, too.

Anyways, here is a self-contained test page for you. It is based on some code initiallyborrowedfrom Ted Glaza, changed to VB, then AJAX, then simplified and then changed to fit this sample! :)

Any solution or workaround you can provide me with, is highly appreciated. I'm already in a time crunch and don't have the luxury of playing around with these controls. By the way, in real life,my popup control has to be launched from imagebuttons in a DataGrid. All are created on the server-side and I can't change that design easily.

Thanks,

Kathy

<%

@.PageLanguage="VB" %>

<%

@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="ajaxToolkit" %>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

scriptrunat="server">ProtectedSub CommandButton_OnSelect(ByVal senderAsObject,ByVal eAs CommandEventArgs)Dim IDAsInteger =CInt(e.CommandArgument)Dim xAs System.Xml.XmlNode = Data.GetXmlDocument.SelectSingleNode(String.Format("descendant::item[@.id='{0}']", ID))IfNot IsNothing(x)Then

myDynamicLabel.Text =

"The URL is: " & x.Attributes("url").ValueElse

myDynamicLabel.Text =

"Item with ID: " & ID.ToString &" could not be found."EndIf

ModalPopupExtender.Show()

EndSub

</

script>

<

htmlxmlns="http://www.w3.org/1999/xhtml">

<

headrunat="server"><title>Untitled Page</title><styletype="text/css">

/*Modal Popup*/

.modalBackground

{background-color:Gray;filter:alpha(opacity=70);opacity:0.7;

}

.modalPopup

{background-color:#FFF8C6;border-width:3px;border-style:solid;border-color:Gray;padding:3px;width:350px;

}

</style>

</

head>

<

body><formid="form1"runat="server"><asp:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering=true/><p>

Some nonsense text to show the postback. blah di blah.

kjdhfjkh ksdhhsdfhj haunnsdju urfh kjhdjkf kjhdflgkh hr ujseopop';ui;j m[plio;l hjyryawre ghvnb mdfb jyutet ihe lijj huhiut hiuhvnmx mnbuyteruy gwerbmbnhfghtf jhel/krtjk ih banvdhtsfr cvnhfhtfd wklieth bnhdchzgf dejhfgkuhgr jwhg

lusyfiuysdkj jutyujefg jgdfjhg hjdgfhjg dkjf jkhgdsf uytser bvioy yhsejehyj mjnbcvjytyue rvkiuyd h j vihbrtkj f

</p><p>

Some nonsense text to show the postback. blah di blah.

kjdhfjkh ksdhhsdfhj hak kkfguhe mndfgkjh dkjg hzsnmbrtulk typi ,bngf aytwr eb mbhjvu ;orijnjm BFMhbmhdfbv ghvme hjmhg fbmbmnb mnbz

unnsdju urfh lusyfiuysdkj jutyujefg jgdfjhg hjdgfhjg dkjf jkhgdsf uytser bvioy yhsejehyj mjnbcvjytyue rvkiuyd h j vihbrtkj f

</p><p>

Some nonsense text to show the postback. blah di blah.

kjdhfjkh ksdhhsdfhj haunnsdju urfh lusyfiuysdkj jutyujefg jgdfjhg hjdgfhjg dkjf jkhgdsf uytser bvioy yhsejehyj mjnbcvjytyue rvkiuyd h j vihbrtkj f

</p><asp:XmlDataSourceID="Data"runat="server"><Data><items><itemid="1"name="ASP.NET"url="http://msdn.microsoft.com"/><itemid="2"name="AJAX"url="http://ajax.asp.net"/><itemid="3"name="AJAX Control Toolkit"url="http://ajax.asp.net/ajaxtoolkit"/></items></Data></asp:XmlDataSource><!-- If you start the UpdatePanel here, clicking the links won't work -->

<!-- Databound list of LinkButtons that fire server side Command events passing in their ID --><asp:DataListID="List"runat="server"DataSourceID="Data"><HeaderTemplate>Microsoft Web Development Technologies:</HeaderTemplate><ItemTemplate><asp:LinkButtonID="CommandButton"runat="server"Text='<%# Eval("name") %>'CommandName="Select"CommandArgument='<%# Eval("id") %>'OnCommand="CommandButton_OnSelect"/></ItemTemplate></asp:DataList><!-- If you start the UpdatePanel here, you need some ControlID for the trigger.

Try CommandButton and you get an error that it doesn't exit.

Try List and the popup doesn't show.

What else?!

You can set it to something totally unrelated, like btnTest for the popup to work

or you can remove the UpdatePanel altogether, since it's no good anyways...

-->

<asp:UpdatePanelID="UPPnl"runat="Server"UpdateMode="Conditional"><ContentTemplate><asp:PanelID="Panel1"runat="server"width=630CssClass="modalPopup"style="display:none">

<asp:LabelID="myDynamicLabel"runat="server"></asp:Label>

<asp:ButtonCssClass="command"ID="Cancel"runat="server"Text="Cancel"CausesValidation="False"/></asp:Panel></ContentTemplate><Triggers><asp:AsyncPostBackTriggerControlID="btnTest"/></Triggers></asp:UpdatePanel>

<ajaxToolkit:ModalPopupExtenderID="ModalPopupExtender"runat="server"TargetControlID="btnTest"PopupControlID="Panel1"BackgroundCssClass="modalBackground"DropShadow="true"OkControlID="Cancel"CancelControlID="Cancel"/><br/><br/><asp:ButtonID="btnTest"runat="server"Text="Don't Click Me!"/></form>

</

body>

</

html>


Kathy,

You seem to be trying to do dynamic population. If so, then I'd recommend the approach I blog here:http://blogs.msdn.com/delay/archive/2006/09/19/762609.aspx.

Alternatively, if you're willing to have slightly larger pages, the below is your sample transformed into a solution that doesn't use postbacks and therefore doesn't need UpdatePanels:

<%@. Page Language="VB" %><%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Untitled Page</title> <style type="text/css"> /*Modal Popup*/.modalBackground{ background-color:Gray; filter:alpha(opacity=70); opacity:0.7; }.modalPopup{ background-color:#FFF8C6; border-width:3px; border-style:solid; border-color:Gray; padding:3px; width:350px; } </style></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" /> <p> Some nonsense text to show the postback. blah di blah. kjdhfjkh ksdhhsdfhj haunnsdju urfh kjhdjkf kjhdflgkh hr ujseopop';ui;j m[plio;l hjyryawre ghvnb mdfb jyutet ihe lijj huhiut hiuhvnmx mnbuyteruy gwerbmbnhfghtf jhel/krtjk ih banvdhtsfr cvnhfhtfd wklieth bnhdchzgf dejhfgkuhgr jwhg lusyfiuysdkj jutyujefg jgdfjhg hjdgfhjg dkjf jkhgdsf uytser bvioy yhsejehyj mjnbcvjytyue rvkiuyd h j vihbrtkj f </p> <p> Some nonsense text to show the postback. blah di blah. kjdhfjkh ksdhhsdfhj hak kkfguhe mndfgkjh dkjg hzsnmbrtulk typi ,bngf aytwr eb mbhjvu ;orijnjm BFMhbmhdfbv ghvme hjmhg fbmbmnb mnbz unnsdju urfh lusyfiuysdkj jutyujefg jgdfjhg hjdgfhjg dkjf jkhgdsf uytser bvioy yhsejehyj mjnbcvjytyue rvkiuyd h j vihbrtkj f </p> <p> Some nonsense text to show the postback. blah di blah. kjdhfjkh ksdhhsdfhj haunnsdju urfh lusyfiuysdkj jutyujefg jgdfjhg hjdgfhjg dkjf jkhgdsf uytser bvioy yhsejehyj mjnbcvjytyue rvkiuyd h j vihbrtkj f </p> <asp:XmlDataSource ID="Data" runat="server"> <Data> <items> <item id="1" name="ASP.NET" url="http://msdn.microsoft.com" /> <item id="2" name="AJAX" url="http://ajax.asp.net" /> <item id="3" name="AJAX Control Toolkit" url="http://ajax.asp.net/ajaxtoolkit" /> </items> </Data> </asp:XmlDataSource> <asp:DataList ID="List" runat="server" DataSourceID="Data"> <HeaderTemplate> Microsoft Web Development Technologies:</HeaderTemplate> <ItemTemplate> <asp:LinkButton ID="CommandButton" runat="server" Text='<%# Eval("name")%>' CommandName="Select" CommandArgument='<%# Eval("id")%>'/> <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="CommandButton" PopupControlID="Panel1" BackgroundCssClass="modalBackground" DropShadow="true" OkControlID="Cancel" CancelControlID="Cancel" /> <asp:Panel ID="Panel1" runat="server" Width="630" CssClass="modalPopup" Style="display: none"> <asp:Label ID="myDynamicLabel" runat="server" Text='<%# Eval("url")%>'></asp:Label> <asp:Button CssClass="command" ID="Cancel" runat="server" Text="Cancel" CausesValidation="False" /> </asp:Panel> </ItemTemplate> </asp:DataList> </form></body></html>

Sorry, for my bad english. Maybe this is the solution for some...

This is a part of a code of ASCX user control in C# and works

....

<asp:UpdatePanel ID="updDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>

<%--CONTROL USER (Not important)... --%>
<delta:filtro ID="Filtro" runat="server" />

<br />

<asp:Button runat="server" ID="btnBuscar" OnClick="btnBuscar_Click" Text="Buscar" />

<%--1. CONTROL USERYes--%>
<delta:resultado ID="Resultado" runat="server" OnSeleccionar="Seleccionar_Click"/
<%--2. Button invisible ...Yes --%>
<div style="display:none">
<asp:LinkButton ID="btnPrevio" runat="server" Text="Any text... " />
</div>

<asp:Panel ID="pnlConfirma" runat="server" CssClass="modalPopup" Style="display: none">
<asp:Panel ID="Panel3" runat="server" Style="cursor: move; background-color: #DDDDDD;
border: solid 1px Gray; color: Black">
<div>
<p>
De aca arrastro...</p>
</div>
</asp:Panel>
<asp:Label ID="lblConfirmacion" runat="server" />
<br />
<asp:Button ID="btnOk" runat="server" Text="Ok" />
<asp:Button ID="btnCancelar" runat="server" Text="Cancelar" />
</asp:Panel>


<ajax:ModalPopupExtender ID="modalConfirmar" runat="server" BackgroundCssClass="modalBackground"
CancelControlID="btnCancelar" DropShadow="true" OkControlID="btnOK" PopupControlID="pnlConfirma"
PopupDragHandleControlID="Panel3" TargetControlID="btnPrevio">
</ajax:ModalPopupExtender
</ContentTemplate>
<Triggers>

<%--3. Trigger of my control userYes--%>
<asp:AsyncPostBackTrigger ControlID="Resultado" EventName="Seleccionar" />

<%--4. IMPORTANT: Trigger of Invisible ButtonGeeked--%>
<asp:AsyncPostBackTrigger ControlID="btnPrevio" EventName="Click" />
</Triggers>
</asp:UpdatePanel>

.........................................................

in code:

protected voidSeleccionar_Click(object sender, EventArgs e) {

//BLA BLA BLA...

//personalize my modal pop up, previously... (bad englishStick out tongue)
lblConfirmacion.Text ="Personalizar el control..."; //Text personalized..

//The event of my control user... trigger the modal pop up...
modalConfirmar.Show();
//BLA BLA BLA...

}

Smile