Hi Im trying to use a modal popup in my project.
Im generating a bunch of control on my form and some of them (buttons) when clicked should open a modalpopup and on okclick store some info in a db
the problem Im having is that when I am not in the tab with the button that will make the popup open, I see the popup, but when im inside the right tab popup disapear and I can't seem to make it appear.
second problem Im having is that I can't seem to find a way for having multiple button to open the same popup.
hmm Now the modal popup is always shown. maybe its a properpy of the target control or of the popup?
Here is the code
<ajaxToolkit:ModalPopupExtenderID="MPE"runat="server"
BackgroundCssClass="modalBackground"
TargetControlID="test"
PopupControlID="PanelAddLine"
DropShadow="true"OkControlID="SavePrice"
CancelControlID="CancelButton"
>
</ajaxToolkit:ModalPopupExtender>
<asp:PanelID="PanelAddLine"runat="server"CssClass="modal">
Enter the number of Days<br/>
<asp:TextBoxID="TextBoxNbDays"runat="server"></asp:TextBox><br/>
<asp:ButtonID="SavePrice"runat="server"OnClick="SavePrice_Click"Text="Add"OnClientClick="AfterAdd()"/>
</asp:Panel>
<asp:HiddenFieldrunat="server"ID="test"Value="a"Visible="false"/>
well im not sure about the tabbing problem because im to busy right now to try to replicate it myselft, but i think i know whats going on with the problem you have trying to open the same modal popup from different buttons. The targetControlID for a modal popup lets you set a button to open the popup, but because you want more then one button to you should do the following
* Create a hidden field and assign its ID as the targetControlID for the modal popup
* Now for each button you have that you want to open the modalPopup, create an eventhandler for the button with this code inside(example further down)
modalPopup1.Show();
* to programmatically add the event for the button do this
myButton.Click += new EventHandler(this.myButton_Click);
* and then write the click function that will be called due to the above code
private void myButton_Click(object sender, EventArgs e)
{
modalPopup1.Show();
}
thats weird, i guess i cant be much more help, i love doing stuff programatically in C# to im not great with the aspx file sytax when stuff like this happens :(
could it be just a question of css?
Do I have to set special value to my css to make the modal popup work.
Can a master page could possibly be reason for this
Wookie:
hmm Now the modal popup is always shown.
I think you need to call MPE.Hide(); in the server side click event handler of the save button.
Also, don't specify OkControlID="SavePrice"
No comments:
Post a Comment