I got this modal popup extender but i can't get the files on the FileUpload control. here's my code:
<asp:Button ID="targC" runat="server" Style="display: none;" Text="here" />
<ajax:ModalPopupExtender ID="myExtender" runat="server" BackgroundCssClass="myModalPopupbackGrnd"
TargetControlID="targC" PopupControlID="pnlUserRegNoti" OkControlID="btnDone">
</ajax:ModalPopupExtender>
<asp:Panel ID="pnlUserRegNoti" Width="70%" Style="display: none;" CssClass="myModalPopupload"
runat="server">
<center>
<br />
<br />
<table width="80%">
<tr>
<td>
<center>
<h3><b>Requirements of New Application</b></h3>
<asp:HiddenField ID="validateUploads" runat="server" />
<table>
<tr>
<td>DTI Application Form</td>
<td><asp:FileUpload ID="dtiFileUpload" runat="server" onchange = "return CheckForTestFileDTI();" />
<asp:CustomValidator ID="CustomValidator1" ControlToValidate="dtiFileUpload" runat="server" OnServerValidate="CustomValidator1_ServerValidate" Text="File is too large. Max size is 20MB."></asp:CustomValidator>
</td>
</tr>
<tr>
<td>
<center>
<asp:Button ID="btnDone" runat="server" CssClass="button" Text="Done" OnClick="btnDone_Click" />
</center>
</td>
</tr>
</table>
</center>
</asp:Panel>
i will be using the file on the FileUpload control to upload to WindowsAzure. how can i get the values on the file upload inside the modalpopupextender?
You will need to to retrieve that FileUpload from within the Panel to interact with it in your code behind:
FileUpload dtiFileUpload = (FileUpload)pnlUserRegNoti.FindControl("dtiFileUpload");
Related
I have 2 Telerik RaddatePicker controls and the button.
<table class="moss2Search">
<tr>
<td>
<div runat="server">
<telerik:RadDatePicker RenderMode="Lightweight" ID="RadDatePicker1" width="100%" runat="server" DateInput-Label="Boarding Start Date">
</telerik:RadDatePicker>
</div>
</td>
<td>
<div runat="server">
<telerik:RadDatePicker RenderMode="Lightweight" ID="RadDatePicker2" width="100%" runat="server" DateInput-Label="Boarding End Date">
</telerik:RadDatePicker>
</div>
</td>
<td>
<div>
<asp:CheckBox ID="chkMerActive" runat="server" Checked="true"/>Active
</div>
</td>
<td>
<%--<asp:Button ID="btnSeacrh" runat="server" Text="Search" OnClick="btnSearch_Click" OnClientClick="return dateValidation();"/> <br />--%>
<telerik:RadButton RenderMode="Lightweight" runat="server" Text="Search" ID="Button1" OnClick="btnSearch_Click" OnClientClicked="validateDates" AutoPostBack="false"></telerik:RadButton>
</td>
</tr>
</table>
How can I validate these 2 controls for a valid date selected, since the user can type a string value as well?
Use the standard validation that comes with the framework. If the user input can be a date the components will have a value, otherwise null or the default so you can also check against that in a a custom validation rule
I am created a page with update panel and used Asp.net validation controls to be
validated the page is making an issue is "i am straightly going to submit the page
and page gets validated properly then, i am going to click/select any controls on
the page is not get post back"
The below code i am used
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<div id="divMyDataManualEntry" runat="server">
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<td style="width: 5%;" valign="top">
<asp:Label ID="lblGeo" Font-Bold="true" runat="server" Text="Geography"></asp:Label><span
class="redtext">*</span>
</td>
<td valign="top" style="width: 15%">
<asp:DropDownList ID="ddlgeo" TabIndex="1" runat="server" CssClass="textbox" Width="100%"
OnSelectedIndexChanged="ddlgeo_SelectedIndexChanged" AutoPostBack="true">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="ddlgeo"
ValidationGroup="Submit" InitialValue="-1" ErrorMessage="Select Geography"></asp:RequiredFieldValidator>
</td>
</tr> </table>
<table width="100%" id="BtnContainer" runat="server">
<tr>
<td align="center">
<asp:Button ID="btnSubmit" runat="server" OnClientClick="javascript:return IsValidated();"
ValidationGroup="Submit" CssClass="Keybutton" TabIndex="14" Text="Submit" OnClick="btnSubmit_Click" />
<asp:Button ID="btnreset" runat="server" Text="Reset" CssClass="Keybutton" TabIndex="15"
OnClick="btnReset_click" />
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
I have designed a modal popup in ASP.net. The task is when I click my button, it has to display a modal popup box. I used AJAX extender control kit also. Below is my coding.
Approval.aspx:
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"/>
<div>
<asp:Button ID="ApproveButton" runat="server" Text="Approve" />
<ajaxToolkit:ModalPopupExtender ID ="mp1" runat="server" PopupControlID="Panel1"
TargetControlID="ApproveButton" CancelControlID="CancelButton">
</ajaxToolkit:ModalPopupExtender>
<!--Modal Panel "Panel1"-->
<asp:Panel ID="Panel1" runat="server" Height="170px" Width="506px">
<table style="width: 100%; height: 164px;">
<tr>
<td>
<asp:Label ID="ReasonLabel" runat="server" Text="Reason for Approval"></asp:Label>
</td>
<td>
<asp:TextBox ID="ReasonTextBox" runat="server" Height="126px"
TextMode="MultiLine" Width="336px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button ID="OkButton" runat="server" Text="Ok" Width="66px" />
<asp:Button ID="CancelButton" runat="server" Text="Cancel" />
</td>
</tr>
</table>
</asp:Panel>
<!--Modal Panel-->
</div>
The problem is, the Popup window is just blinking once when I clicked the button. It is not displaying the popup permanently.
I am using ajax model popup extender in my asp.net page. From my page , on click of Save button , i popup panel using model popup extender.
If i cause postback from model popup , my backend (asp.net) form controls are coming front (ie) in the panel.
Here is my code snippet,
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="up_Save" runat="server">
<ContentTemplate>
<div>
<table border="0" cellpadding="2" cellspacing="2" width="100%">
<tr>
<td align="center" colspan="4">
<asp:Button ID="btn_Save" runat="server" Text="Save" Width="15%" OnClick="btn_Save_Click" />
</td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<cc1:ModalPopupExtender ID="BarrierRelayPopup" runat="server" PopupControlID="PopUp_Panel" TargetControlID="hiddenfield" CancelControlID="btn_Cancel_PopUp">
</cc1:ModalPopupExtender>
<asp:HiddenField ID="hiddenfield" runat="server" />
<asp:Panel runat="server" ID="PopUp_Panel" Width="50%" Height="30%" BackColor="Gainsboro" BorderStyle="Groove" >
<asp:UpdatePanel runat="server" ID="PopUp">
<ContentTemplate>
<table>
<tr>
<td align="left">
<asp:Label ID="lbl_Heading" runat="server" Text="Select Relay and Barrier :"></asp:Label>
</td>
</tr>
<tr>
<td>
<B_R:Barrier_Relay ID="Barrier_Relay" runat="server"/>
</td>
</tr>
<tr>
<td align="center">
<asp:Button ID="btn_OK" runat="server" Width="60px" Text="OK" OnClick="btn_OK_Click" /> <asp:Button ID="btn_Cancel_PopUp" runat="server" Width="60px" Text="Cancel" OnClick="btn_Cancel_PopUp_Click"/>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
</form>
Can anybody help me in this.
If I understand you right I think what you want to do is wrap the controls inside the modal in an updatepanel. This will prevent the modal from closing if you need to do a postback from within the popup.
I'm having a heck of a time trying to get a gridview to refresh its data after a modalpopup adds a new record to the database. Ive tried the following with no luck.
<cc2:ModalPopupExtender ID="mdlPopup" runat="server" OnOkScript="__doPostBack('<%= gvRecommendations.ClientID %>', '');" BackgroundCssClass="modalBackground"
TargetControlID="lbtnRecommendationsAddNew" PopupControlID="pnlAddNewRecommendation">
</cc2:ModalPopupExtender>
<asp:Panel ID="pnlAddNewRecommendation" runat="server" CssClass="confirm-dialog" style="display:none;" Width="500px">
<div class="inner">
<h2>New Suppressed Recomendation</h2>
<div class="base">
<table width="100%" cellpadding="5" cellspacing="0">
<tr>
<td align=left>
<asp:DropDownList ID="ddlRecomendations" runat="server" />
</td>
</tr>
<tr>
<td align="left">
<asp:Button ID="btnAddRecommendation" OnClick="btnAddRecommendation_Click" runat="server" Text="Submit" />
|
<asp:LinkButton ID="btnCancel" runat="server" Text="Cancel" ForeColor="Blue" />
<asp:LinkButton id="lbtnTopLeft" runat="server" CssClass="close" />
</div>
</td>
</tr>
</table>
</div>
</div>
</asp:Panel>
Ive also tried adding this with no luck after adding the record to the DB:
this.gvSupressedRecommendations.DataBind();
this.UpdatePanel1.Update();
I know im close but can't seem to get this to refresh.
Try reassigning your datasource before you rebind. This should work. I.e.
gvSupressedRecommendations.DataSource = <...>;
gvSupressedRecommendations.DataBind();