Click here to Skip to main content
12,699,807 members (35,583 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#2.0 C# ASP.NET jQuery
hi all,
i am having some problems in wizard controls.
i have a page that contains a wizard control(16 steps).each step contains a user control).
page also have some user controls directly placed.
problem i m facing are.

1.i need to make page as read-only(i.e. user can navigate to next and previous steps but cant modify anything).except the user controls that are placed directly placed on page.

what i have done till now...
i have used one java script function as below

function DisableControls() {
//debugger;
$("form :input").attr("disabled", "disabled");
var $ControlsToEnabled = $(':input.EnableConrols');
var count = 0;
var length = $ControlsToEnabled.length;
while (count < length) {
var Control = $ControlsToEnabled[count];
Control.disabled = false;
count++;
}
var $controlstodisabled = $('.linkdisable');
$('a').attr('linkdisable', 'disabled');
var count1 = 0;
var length = $controlstodisabled.length;
debugger;
while (count1 < length) {
var control = $controlstodisabled[count1];
control.disabled = true;
count1++;
}
}

this function is working ...i m able to disable controls but problem is link buttons that are inside usercontrols that are directly place don page are seems to be disabled but on click it causes postback...and again all controls get enabled..

below is my Page source..

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RmsViewWorkSheetDetails.aspx.cs"
Inherits="RMS.RmsViewWorkSheetDetails" Theme="RMSTheme" MasterPageFile="~/RMS/RMS.Master"
ValidateRequest="false" %>

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Src="../UC/StudentInformation.ascx" TagName="StudentInformation" TagPrefix="uc1" %>
<%@ Register Src="../UC/WithdrawalDates.ascx" TagName="WithdrawalDates" TagPrefix="uc2" %>
<%@ Register Src="../UC/WithdrawalNotification.ascx" TagName="WithdrawalNotification"
TagPrefix="uc3" %>
<%@ Register Src="../UC/GeneralEligibility.ascx" TagName="GeneralEligibility" TagPrefix="uc4" %>
<%@ Register Src="../UC/PaymentPeriodMapping.ascx" TagName="PaymentPeriodMapping"
TagPrefix="uc5" %>
<%@ Register Src="../UC/LOAsOrBreaks.ascx" TagName="LOAsOrBreaks" TagPrefix="uc6" %>
<%@ Register Src="../UC/ISIRInformation.ascx" TagName="ISIRInformation" TagPrefix="uc7" %>
<%@ Register Src="../UC/SAP.ascx" TagName="SAP" TagPrefix="uc8" %>
<%@ Register Src="../UC/R2T4CalculationResults.ascx" TagName="R2T4CalculationResults"
TagPrefix="uc9" %>
<%@ Register Src="../UC/RefundAction.ascx" TagName="RefundAction" TagPrefix="uc10" %>
<%@ Register Src="../UC/InstitutionalCharges.ascx" TagName="InstitutionalCharges"
TagPrefix="uc11" %>
<%@ Register Src="../UC/AwardInformationforPP.ascx" TagName="AwardInformationforPP"
TagPrefix="uc12" %>
<%@ Register Src="../UC/CHBDFromPreviousCompletedPPs.ascx" TagName="CHBDFromPreviousCompletedPPs"
TagPrefix="uc13" %>
<%@ Register Src="../UC/ScheduledDisbursements.ascx" TagName="ScheduledDisbursements"
TagPrefix="uc14" %>
<%@ Register Src="../UC/CalculationSummary.ascx" TagName="CalculationSummary" TagPrefix="uc15" %>
<%@ Register Src="../UC/Comments.ascx" TagName="Comments" TagPrefix="uc16" %>
<%@ Register Src="../UC/Notifications.ascx" TagName="Notifications" TagPrefix="uc17" %>
<%@ Register Src="../UC/AddDisableHold.ascx" TagName="Hold" TagPrefix="uc18" %>
<%@ Register Src="~/RMS/UC/PendedFileInformation.ascx" TagName="Pend" TagPrefix="uc19" %>
<%@ Register Src="../UC/AssignmentInformation.ascx" TagName="AssignmentInformation"
TagPrefix="uc20" %>
<%@ Register Src="../UC/QAInformation.ascx" TagName="QAInformation" TagPrefix="uc21" %>
<%@ Register Src="~/RMS/UC/AssignReAssign.ascx" TagName="AssignReassign" TagPrefix="uc22" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style type="text/css">
.reportBackGround
{
background-color: #404040;
opacity: 0.75;
filter: alpha(opacity=75);
}


</style>

<script type="text/javascript">
<%--.enabled { disabled: ""; }--%>
function onUpdating() {
// get the divImage
var panelProg = $get('divImage');
// set it to visible
panelProg.style.display = '';

// hide label if visible
var lbl = $get('<%= this.lblText.ClientID %>');
lbl.innerHTML = '';
}

function onUpdated() {
// get the divImage
var panelProg = $get('divImage');
// set it to invisible
panelProg.style.display = 'none';
}


</script>

<asp:Content ID="Content2" ContentPlaceHolderID="mainContentPlaceHolder" runat="server">
<asp:UpdatePanel ID="UpdatePanel5" runat="server">
<contenttemplate>






<uc20:AssignmentInformation ID="ucAssignmentInformation" runat="server" />

<uc22:AssignReassign ID="ucAssignReAssign" runat="server" />



<asp:UpdatePanel runat="server" ID="UpdatePanel8">
<contenttemplate>
<asp:Wizard ID="wzd" runat="Server" Width="100%" DisplaySideBar="false" OnNextButtonClick="wzd_OnNextButtonClick"
OnPreviousButtonClick="wzd_OnPreviousButtonClick" OnFinishButtonClick="wzd_OnFinishButtonClick"
HeaderText="Worksheet Data Fields" HeaderStyle-Font-Bold="true" steptype="auto">
<wizardsteps>
<asp:WizardStep ID="WizardStep1" runat="server" StepType="Start">
<uc1:StudentInformation ID="ucStudentInformation" runat="server" />

<asp:WizardStep ID="WizardStep2" runat="server" StepType="Step">
<uc2:WithdrawalDates ID="ucWithdrawalDates" runat="server" />

<asp:WizardStep ID="WizardStep3" runat="server" StepType="Step">
<uc3:WithdrawalNotification ID="ucWithdrawalNotification" runat="server" />

<asp:WizardStep ID="WizardStep4" runat="server" StepType="Step">
<uc4:GeneralEligibility ID="ucGeneralEligibility" runat="server" />

<asp:WizardStep ID="WizardStep5" runat="server" StepType="Step">
<uc5:PaymentPeriodMapping ID="ucPaymentPeriodMapping" runat="server" Header="Payment Period Mapping"
HeadingURL="../Documents/Payment Period Mapping Calculator.xls" />

<asp:WizardStep ID="WizardStep6" runat="server" StepType="Step">
<uc6:LOAsOrBreaks ID="ucLOAsOrBreaks" runat="server" />

<asp:WizardStep ID="WizardStep7" runat="server" StepType="Step">
<uc7:ISIRInformation ID="ucISIRInformation" runat="server" />

<asp:WizardStep ID="WizardStep8" runat="server" StepType="Step">
<uc8:SAP ID="ucSAP" runat="server" />

<asp:WizardStep ID="WizardStep9" runat="server" StepType="Step">
<uc9:R2T4CalculationResults ID="ucR2T4CalculationResults" runat="server" />

<asp:WizardStep ID="WizardStep10" runat="server" StepType="Step">
<uc10:RefundAction ID="ucRefundAction" runat="server" />

<asp:WizardStep ID="WizardStep11" runat="server" StepType="Step">
<uc11:InstitutionalCharges ID="ucInstitutionalCharges" runat="server" />

<asp:WizardStep ID="WizardStep12" runat="server" StepType="Step">
<uc12:AwardInformationforPP ID="ucAwardInformationforPP" runat="server" />

<asp:WizardStep ID="WizardStep13" runat="server" StepType="Step">
<uc13:CHBDFromPreviousCompletedPPs ID="ucCHBDFromPreviousCompletedPPs" runat="server" />

<asp:WizardStep ID="WizardStep14" runat="server" StepType="Step">
<uc14:ScheduledDisbursements ID="ucScheduledDisbursements" runat="server" />

<asp:WizardStep ID="WizardStep15" runat="server" StepType="Step">
<uc15:CalculationSummary ID="ucCalculationSummary" runat="server" />

<asp:WizardStep ID="WizardStep16" runat="server" StepType= "Finish">
<uc5:PaymentPeriodMapping ID="ucCertificationMapping" Header="Certification Mapping"
runat="server" />


<navigationstyle backcolor="#EEEEEE" borderstyle="Solid" bordercolor="#000099" borderwidth="1" />
<navigationbuttonstyle />
<stepstyle horizontalalign="Center" verticalalign="Top" height="100px" borderstyle="Solid">
BorderColor="#000099" BorderWidth="1" />
<startnavigationtemplate>





<asp:Button ID="btnNext" runat="server" Text="Next >>" CausesValidation="true" CommandName="MoveNext" CssClass="EnableConrols" />


<stepnavigationtemplate>






<asp:Button ID="btnPrevious" runat="server" Text="<< Previous" CausesValidation="true"
CommandName="MovePrevious" CssClass="EnableConrols" />

<asp:Button ID="btnNext" runat="server" Text="Next >>" CausesValidation="true" CommandName="MoveNext" CssClass="EnableConrols"/>


<finishnavigationtemplate>






<asp:Button ID="btnPrevious" runat="server" Text="<< Previous" CausesValidation="true"
CommandName="MovePrevious" CssClass="EnableConrols" />

<asp:Button ID="btnFinish" runat="server" Text="Finish" CausesValidation="true" CommandName="MoveComplete" CssClass="EnableConrols" />






<asp:HiddenField ID="hdnWizStep" Value="0" runat="server" />























<asp:UpdatePanel ID="UpdatePanel7" runat="server">
<contenttemplate>
<asp:Label ID="lblText" runat="server" Text="">

<asp:Image ID="img1" runat="server" ImageUrl="~/images/ajax/progressAnimation.gif" />



<ajaxToolkit:UpdatePanelAnimationExtender ID="UpdatePanelAnimationExtender1"
TargetControlID="UpdatePanel8" runat="server">
<animations>
<onupdating>
<parallel duration="0">
<ScriptAction Script="onUpdating();" />
<enableaction animationtarget="btnInvoke" enabled="true" />


<onupdated>
<parallel duration="0">
<ScriptAction Script="onUpdated();" />
<enableaction animationtarget="btnInvoke" enabled="true" />





<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<contenttemplate>
<uc18:Hold ID="ucHold" runat="server" />



<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<contenttemplate>
<uc19:Pend ID="ucPendedFiles" runat="server" />



<asp:UpdatePanel ID="UpdatePanel3" runat="server">
<contenttemplate>
<uc17:Notifications ID="ucNotifications" runat="server" />



<asp:UpdatePanel ID="UpdatePanel4" runat="server">
<contenttemplate>
<uc16:Comments ID="ucComments" runat="server" />



<asp:UpdatePanel ID="UpdatePanel6" runat="server">
<contenttemplate>
<asp:Button ID="btnSubmit" Text="Submit" runat="server" OnClick="btnSubmit_OnClick" />





<asp:LinkButton ID="disableLink" runat="server" Text="Disable it" PostBackUrl="~/RMS/WebPages/RmsViewWorkSheetDetails.aspx" />


<script type="text/javascript" language="javascript" src="../Scripts/common.js"></script>
<script type="text/javascript">

$(".summable").live("blur", function () {



// var ctrl =document.getElementById('ctl00_mainContentPlaceHolder_wzd_ucCalculationSummary_lblPwdAmount') //first find usercontrol, and then inside repeater find
var ctrl = document.getElementById('ctl00_mainContentPlaceHolder_wzd_ucCalculationSummary_lblPwdAmount')
var ttl = parseFloat(ctrl.innerText)
if (ttl != "") {

var sum = 0;
var serviceList = document.getElementsByTagName("input");
for (var i = 0; i < serviceList.length; i++) {
if (serviceList[i].className == "summable") {

var obj = serviceList[i];
obj.value;
if (obj.value != "") {
sum = parseFloat(sum) + parseFloat(obj.value);
}

}

}
if (sum > ttl) {
alert("total cannot be greater than PWD Amount");
}

}

});





function validate(lblPwdAmount, txtChargesPdFrmPWD, lblPwdAmtDrctStud) {
debugger;
var result = parseFloat(lblPwdAmount.innerText) - parseFloat(txtChargesPdFrmPWD.value);
if (result < 0) {
lblPwdAmtDrctStud.innerText = "$" + 0;


}
else {

lblPwdAmtDrctStud.innerText = "$" + result;


}
}

function checkTotalSum(textBoxId, hdnFldId, lblPwdAmountId) {

hdnFldId.value += parseFloat(textBoxId.value);
if (parseFloat(hdnFldId.value) > parseFloat(lblPwdAmountId.innerText)) {
alert("The total amount entered cannot be more than the amount in the PWD Amount");
hdnFldId.value -= parseFloat(textBoxId.value());
}


}

function checkTotalSumByClass(lblPwdAmountId) {
debugger;
var total = parseFloat(lblPwdAmountId.innerText);
var sum = 0;
var serviceList = document.getElementsByTagName("input");
for (var i = 0; i < serviceList.length; i++) {
if (serviceList[i].className == "summable") {

var obj = serviceList[i];
obj.value;
if (obj.value != "") {
sum = parseFloat(sum) + parseFloat(obj.value);
}

}

}
if (sum > total) {
alert("total cannot be greater than PWD Amount");
}
}


</script>





2. one more problem is that on page load next button is enabled ..on click on next button privious button gets enabled but rest of all other controls of entire page also gets enabled..

plz reply if some one can help me on this....
thanks.
Posted 27-Nov-12 2:20am
Comments
loctrice 27-Nov-12 8:47am
   
Please format your post.
vinodkumarnie 21-Jan-13 23:58pm
   
You can disable input controls manually in source code itself..

Ex: <asp:TextBox ID="TextBox1" runat="server" Enabled="false">
<asp:DropDownList ID="DropDownList1" runat="server" Enabled="false">
<asp:ListItem Text="Select">
<asp:ListItem Text="Item 1">
<asp:ListItem Text="Item 2">


Is this you are looking for..?

Thank you..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 27 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100