Showing posts with label dropdownlist. Show all posts
Showing posts with label dropdownlist. Show all posts

Wednesday, March 21, 2012

modalpopup

hii need to use a modalpopup to add an item to my dropdownlist.my dropdownliste extract the itmes from an oracle database.

the client click on a botton to add the new item in the database and i want that the ddl refreshe.

can u help me plez.

1<asp:Panel runat="server" id="pnl_add">2 <asp:TextBox runat="server" id="txt_name" />3 <asp:RequiredFieldValidator runat="server" id="rfv_name"4 ControlToValidate="txt_name"5 ToolTip="Please enter a name"6 ErrorMessage=" *" />7 <asp:Button runat="server" id="btn_ok"8 Text="Ok" />9 <asp:Button runat="server" id="btn_cancel"10 Text="Cancel" />11</asp:Panel>12<ajaxToolkit:ModalPopupExtender runat="server" id="mpe_add"13 TargetControl="btn_add"14 PopupControlID="pnl_add"15 CancelControlID="btn_Cancel" />1617<asp:UpdatePanel runat="server" id="up_items"18 RenderMode="block"19 UpdateMode="conditional">20 <Triggers>21 <asp:AsyncPostBackTrigger22 ControlID="btn_Ok"23 EventName="Click" />24 </Triggers>25 <ContentTemplate>26 <asp:DropDownList runat="server" id="ddl_items" />27 </ContentTemplate>28</asp:UpdatePanel>
1Protected Sub btn_Ok_Click(sender asObject, e as EventArgs) handles btn_Ok.Click2'insert into database34 up_items.Update()5End Sub

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!