Hi guys:
I have a modalPopup and inside it I have a formView linked to a GridView, and I also have a text box and a button to let the user Add a new record.The point is, when the user will click in the OkButton, to close the modalPopup, I want to clean the popup window, I Mean: clean the textbox, de-select the GridView, just for the next time..When the user gonna open again don't find the old tasks.So I put some code behind on click event of the OkButton, but it doesn't work, It doesn't do anything.So I think it is disable for any event by the fact to be the OkButton of the ModalPopupExtender, so how can I solve it?Maybe putting some Java Script onclick Event?I don't know how to do that.
Any help!Thanks Marcos
The button click event should fire, if you do not set the button as the ModalPopups OkButton.
(i also figured out that no events inside a modalpopup fires when the tragetcontrolid is set to an surronounding elelemt (e.g. the panel you want to pop up)
(an in the button's event handler, simply close the modalpopup with it's Hide() method)
thanks a lot for answer me!
If you can, please explain me better, I am new in all this and I've no much experience.
I didn't understand you well, maybe for my english.
Some comments about:
-can you please put some code for understand you idea!
- of course the Ok button don't fire becouse is set as okbutton of the modalPopup, i Know that but i also want to fire a other events in order to clean the modalPopup.
Myabe you gave me the solution but I didnt get it, sorry, if you can give some additional comments about.
I wan to do something like that:
In the aspx Code put some JS like that:
<JavaScript>..
MiJavaScrip()
{ here is the code, by example clean a textBox
}
</JavaScript>..
and In the button aspx code:
<asp:ButtonID="YesButton"runat="server"Text="Close"onClick="MiJavaScrip()" />
But I am not good with JS, and I dont know if this is the best practice for this case
Thanks again!
Marcos
I wan to do something like that:
<asp:Button ID="Button1" runat="server" Text="open windows popup" /
<asp:Panel ID="Panel1" runat="server" Width="125px" BackColor="yellow">
popup window
<br />
<asp:Button ID="Button2" runat="server" Text="OK" />
<asp:Button ID="Button3" runat="server" Text="Cancel" />
</asp:Panel
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
CancelControlID="Button3"
OkControlID="Button2"
OnCancelScript="Cancel()"
OnOkScript="OK()"
PopupControlID="Panel1"
TargetControlID="Button1">
</ajaxToolkit:ModalPopupExtender
<script type="text/javascript">
function OK()
{
alert(' you press OK');
}
function Cancel()
{
alert('you press Cancel');
}
</script>
With the diference that In the javaScript I want to call to my VB code behind "CleanPopupWindows"
And CleanPopupWindows is like this:
Private sub CleanPopupWindows()
textBox1.text = ""
....etc
End Sub
How can I do this?
thanks!
When you click the OK button, this will trigger the event attached to it, which you know...
protected void btnModalOk_Click(object sender, EventArgs e){// put your "clean box code here" // Use this to hide the modal programatically ModalPopup.Hide();}That can be used in Java on the client side to close the popup without a postback also. Just put the method inside a Javascript script tag, or use it in your code-behind with a postback.
I'm not sure if you were asking for the code to clear the actual box, but I dont think you were. Hope this helps some... You might want to brush up on Java. I didn't know it before ajax either but it forced me to learn it.
thanks a lot, I putted the ok, button inside the updatePanel that is in the modalPopup, and I just did a modalPopupState.Hide and that is !
thanks agian!
No comments:
Post a Comment