Showing posts with label value. Show all posts
Showing posts with label value. Show all posts

Wednesday, March 28, 2012

Modal popup and postback

Hello,
I'm using a modal popup which contains a OkButton which should normally do a postback to save the option value.
But the postback is not done, either in a regular form (not in an update panel) nor an atlas form, simply nothing is done.
Is it a way to do that? The description of the control says just to do postback like normal ones.
You can see this bug here:http://www.wdagent.com, clic on the messaging on the right menu the on "options" (you can see that the page is not reloaded and the updateprogress loading is not shown).

The code is the following :
[code}
<act:ModalPopupExtender ID="OptionsPopUpMaker" runat="server">
<act:ModalPopupProperties TargetControlID="OptionsButton" PopupControlID="Options" BackgroundCssClass="modalBackground" DropShadow="false" OkControlID="ValidateOptionsButton" CancelControlID="CancelOptionsButton" />
</act:ModalPopupExtender>

<div style="display: none;">
<asp:Panel ID="Options" runat="server" Height="80px" Width="300px" CssClass="modalPopup">
<asp:RadioButton ID="OptionsFriendsBig" runat="server" GroupName="Options" Text="Afficher les contacts détaillés" /><br />
<asp:RadioButton ID="OptionsFriendsSmall" runat="server" GroupName="Options" Text="Afficher les contacts simples" /><br /><br />
<div style="text-align: right;"><asp:Button ID="ValidateOptionsButton" runat="server" Text="Save preferences" OnClick="SetFriendsOptions" /><asp:Button ID="CancelOptionsButton" runat="server" Text="Cancel" /></div>
</asp:Panel>
</div
I noticed a huge number of bugs in this toolkit (i wasn't even able to use a control bug free!) like :
- The title of the page disapear when clicking on expand/collapse link of a collapsible panel (i rewrited the javascript for this) and disable the partial rendering of the page.
- The textboxwatermark disable the partial rendering of the page (i don't know how it is possible but it is...).

Thanks for your helpSorryn the "options" is in the "friends" tab
chech this out, it could give you an idea or a way to solve it..
what you really could do is:
do a javascript call like:
__doPostBack('ValidateOptionsButton', '');
on the save button

but you will notice that your controls (OptionsFriendsSmall)will not hold the values for the postback
so you will have to assign them o another hidden control before the postback

so to test the postback your modalpopupextender property onOkScript will look like:

OnOkScript="__doPostBack('ValidateOptionsButton', '')"

if this works but doenst post back the values of theOptionsFriendsSmall create a hidden field and ajava script function that saves the value to the hidden field first and then does the postsback call.

for example:
OnOkScript="savevalue(seletedvalue)"

and inside thesavevalue function do the__doPostBack



Please also have a look at the following threads for ModalPopup background/fixes:http://forums.asp.net/thread/1277351.aspx,http://forums.asp.net/thread/1287520.aspx.


thanks :)

Monday, March 26, 2012

Modal Popup from Code Behind ?

Is there a way I can use the modal popup extender from the code behind? I'd like it to popup as a "confirm" dialog if a value in the form is within a specific range. ie: if a date is less than three days away.

Thanks !!!

Probably the best way to do this is to place your form controls inside of an update panel. Then based on the items chosen you change the enabled property on the modal popup extender. You could add the control to the Controls set on your page, but depending on your form validation, that may happen too late in the game.

Hope that helps!

Wednesday, March 21, 2012

ModalPopUp - Getting value from DropDownList

I have a dropdownlist in my modal pop up and when I click the submit button the page posts back but DropDownList.SelectedValue is empty. I need that value so that I can submit to the database when the btnSubmit_Click method is fired.

My modal extender:

<atlasToolkit:ModalPopupExtenderID="ModalPopupExtender_AddEntity"runat="server"><atlasToolkit:ModalPopupPropertiesTargetControlID="imgBtn_AddEntity"DropShadow="true"PopupControlID="pnlAddEntityModal"CancelControlID="btnCancelEntity"BackgroundCssClass="modalBackground"OkControlID="btnAddEntity"/></atlasToolkit:ModalPopupExtender>

My Submit button:

<

asp:Buttonid="btnAddEntity"Width="110"runat="server"Text="Submit"CssClass="button"OnClick="btnSubmit_Click"UseSubmitBehavior="false"/>Might you be hitting the issue outlined in the following post:http://forums.asp.net/thread/1316941.aspx?

Actually I was able to solve the problem using this bit of Javascript and C#. BUT, it seems that the selected value of the dropdownlist is not always there. It seems a littl buggy. Can someone look at my code and let me know if I am missing something:

<scripttype="text/javascript">var selectedEntity;var selectedProperty;//var selectedValues;function onOk() {

selectedEntity = document.getElementById(

'ddlEntity').value +"-" + document.getElementById('ddlProperty').value;//selectedProperty = document.getElementById('ddlProperty').value;//selectedValues = selectedEntity + "-" + selectedProperty;

__doPostBack(

'btnAddEntity',selectedEntity);

}

</script>

<atlasToolkit:CascadingDropDownID="CascadingDropDown1"runat="server"><atlasToolkit:CascadingDropDownPropertiesTargetControlID="ddlEntity"Category="Entity"PromptText="<-- Selected an Entity -->"ServicePath="webservices/ws_Timetracking.asmx"ServiceMethod="GetEntites"/><atlasToolkit:CascadingDropDownPropertiesTargetControlID="ddlProperty"ParentControlID="ddlEntity"PromptText="<-- Select a Property -->"ServiceMethod="GetPropsForEntity"ServicePath="webservices/ws_Timetracking.asmx"Category="Property"/></atlasToolkit:CascadingDropDown>

<atlasToolkit:ModalPopupExtenderID="ModalPopupExtender_AddEntity"runat="server"><atlasToolkit:ModalPopupPropertiesTargetControlID="imgBtn_AddEntity"DropShadow="true"PopupControlID="pnlAddEntityModal"CancelControlID="btnCancelEntity"BackgroundCssClass="modalBackground"OkControlID="btnAddEntity"OnOkScript="onOk()"/></atlasToolkit:ModalPopupExtender>

Sorry, I'm not seeing the empty SelectedValue issue on my end with the recent 60626 release. If you still see it with that release, could you please post a small, simple example of the problem so we can look into it further? Thanks!


You're talking about the AtlasControlKit release, right? I have 1.0.60504.0. Do I just download the lastest version and Add Reference to the AtlasControlKit.dll into my project?

Yes, the AtlasControlToolkit release 60626 which can be downloaded from here:http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=AtlasControlToolkit&ReleaseId=70

You download it and extract the files and you'll see an environment very much like the 60504 release, except with additional controls, some fixes, automated testing, etc.. You should be able to substitute the new 60626 versions of AtlasControlToolkit.dll and Microsoft.AtlasControlExtender.dll for the old 60504 versions without any problems. Just remove the references to the old DLLs and add references to the new ones and you should be set!