Using ajax calendar extension to update server side chart range - c#

This may be a long shot, but I'm trying to use the client side ajax calendar to select a range of dates for the x-axis of my server side chart. I have both controls set up, I'm just not sure how to get them to communicate with each other or if it's even possible.
This is what I have so far:
<table>
<tr>
<td>
Start Date
</td>
<td>
<asp:TextBox ID="StartDateTextBox" runat="server"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="StartCal" runat="server"
TargetControlID="StartDateTextBox">
</ajaxToolkit:CalendarExtender>
</td>
<td>
End Date
</td>
<td>
<asp:TextBox ID="EndDateTextBox" runat="server"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="EndCal" runat="server" TargetControlID="EndDateTextBox">
</ajaxToolkit:CalendarExtender>
</td>
</tr>
<tr>
<td colspan="4">
<asp:Chart ID="TrendChart" runat="server" Width="800px" Height="400px">
<Series>
<asp:Series Name="Trend" ChartType="Line">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1" Area3DStyle-Enable3D="true">
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
</td>
</tr>
<tr>
<td align="center" colspan="4">
<asp:Button ID="TrendChartButton" runat="server" Text="Export To CSV"
CommandArgument="TrendChart" onclick="OverviewChartButton_Click" />
</td>
</tr>
</table

Related

cascading drop down list does not load in page load event?

i have an user control in that i used cascading drop down for states,districts and areas...how to load cascading drop down in user control page load....cascading Drop down code is
<table>
<tr>
<td class="caption">
State:
<asp:DropDownList ID="ddlCState" runat="server" CssClass="userentry">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cdlCStates" TargetControlID="ddlCState" PromptText="Select State"
ServicePath="~/CasCadingDropDown.asmx" ServiceMethod="GetStates" runat="server"
Category="StateId" LoadingText="Loading..." />
</td>
</tr>
<tr>
<td class="caption">
District:
<asp:DropDownList ID="ddlCDistrict" runat="server" CssClass="userentry">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cdlCDistrict" TargetControlID="ddlCDistrict" PromptText="Select District"
ServicePath="~/CasCadingDropDown.asmx" ServiceMethod="GetDistricts" runat="server"
Category="DistrictId" ParentControlID="ddlCState" LoadingText="Loading..." />
</td>
</tr>
<tr>
<td class="caption">
Area:
<asp:DropDownList ID="ddlCArea" runat="server" CssClass="userentry">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cdlCAreas" TargetControlID="ddlCArea" PromptText="Select Area"
ServicePath="~/CasCadingDropDown.asmx" ServiceMethod="GetAreas" runat="server"
Category="AreaId" ParentControlID="ddlCDistrict" LoadingText="Loading..." />
</td>
</tr></table>

Remove username validate createuserwizard

I'm building a login and register page for a website with Asp.Net
In login page have a popup register form.
A problem in this is : I wanna use my validate for user but I cannot disable validator of CreateUserWizard.
1/ How can I turn off the Validator ? It doesnt work nice.
2/ If I have a textbox or another component in Wizard Template (ex : a textbox in ContentTemplate of CreateUserWizard. How can I call that textbox in my code ? I dont wanna use question and anwser box. I wanna use a new field but I can't call it in my code.
Thanks and sorry for my English
<asp:CreateUserWizard ID="CreateUserWizard2" runat="server">
<WizardSteps>
<asp:CreateUserWizardStep ID="CreateUserWizardStep2" runat="server">
<ContentTemplate>
<table>
<tr>
<td align="center" colspan="2">
Sign Up for Your New Account</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label>
</td>
<td>
<asp:TextBox ID="UserName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server"
ControlToValidate="UserName" ErrorMessage="User Name is required."
ToolTip="User Name is required." ValidationGroup="CreateUserWizard2">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
</td>
<td>
<asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server"
ControlToValidate="Password" ErrorMessage="Password is required."
ToolTip="Password is required." ValidationGroup="CreateUserWizard2">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="ConfirmPasswordLabel" runat="server"
AssociatedControlID="ConfirmPassword">Confirm Password:</asp:Label>
</td>
<td>
<asp:TextBox ID="ConfirmPassword" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="ConfirmPasswordRequired" runat="server"
ControlToValidate="ConfirmPassword"
ErrorMessage="Confirm Password is required."
ToolTip="Confirm Password is required." ValidationGroup="CreateUserWizard2">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="EmailLabel" runat="server" AssociatedControlID="Email">E-mail:</asp:Label>
</td>
<td>
<asp:TextBox ID="Email" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="EmailRequired" runat="server"
ControlToValidate="Email" ErrorMessage="E-mail is required."
ToolTip="E-mail is required." ValidationGroup="CreateUserWizard2">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="QuestionLabel" runat="server" AssociatedControlID="Question">Security Question:</asp:Label>
</td>
<td>
<asp:TextBox ID="Question" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="QuestionRequired" runat="server"
ControlToValidate="Question" ErrorMessage="Security question is required."
ToolTip="Security question is required." ValidationGroup="CreateUserWizard2">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="AnswerLabel" runat="server" AssociatedControlID="Answer">Security Answer:</asp:Label>
</td>
<td>
<asp:TextBox ID="Answer" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="AnswerRequired" runat="server"
ControlToValidate="Answer" ErrorMessage="Security answer is required."
ToolTip="Security answer is required." ValidationGroup="CreateUserWizard2">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:CompareValidator ID="PasswordCompare" runat="server"
ControlToCompare="Password" ControlToValidate="ConfirmPassword"
Display="Dynamic"
ErrorMessage="The Password and Confirmation Password must match."
ValidationGroup="CreateUserWizard2"></asp:CompareValidator>
</td>
</tr>
<tr>
<td align="center" colspan="2" style="color:Red;">
<asp:Literal ID="ErrorMessage" runat="server" EnableViewState="False"></asp:Literal>
</td>
</tr>
</table>
</ContentTemplate>
</asp:CreateUserWizardStep>
<asp:CompleteWizardStep ID="CompleteWizardStep2" runat="server">
</asp:CompleteWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
The wizards a generally that - closed wizards. You can easily create your own login / registration using the membership classes as exposed in code. Then you have full control over them.

asp.net dropdown postback not working on firefox

I am using dropdownlist placed inside ajax tab container.but it doesnt postback even though i have set autopostback property to true.This happens only in firefox and not in IE or chrome.Can any body help me regarding this.I am using ajax toolkit version 4.1.50731.0.
<asp:TabContainer ID="TabContainer2" runat="server" Width="100%" CssClass="myTab"
Height="2200px" ActiveTabIndex="0">
<asp:TabPanel ID="TabPanel8" runat="server" HeaderText="Add Transaction">
<ContentTemplate>
<div>
<table class="style1">
<tr>
<td class="style16">
</td>
<td align="right" class="style15">
Select News Heading :  
</td>
<td>
<asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"
AutoPostBack="True" >
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ControlToValidate="DropDownList1"
ErrorMessage="Please Select News Heading" ValidationGroup="a" InitialValue="Select News Heading">*</asp:RequiredFieldValidator><asp:ValidatorCalloutExtender
ID="RequiredFieldValidator12_ValidatorCalloutExtender" runat="server" Enabled="True"
TargetControlID="RequiredFieldValidator12">
</asp:ValidatorCalloutExtender>
<asp:Label ID="Label3" runat="server"></asp:Label>
</td>
<td>
  
</td>
</tr>
<tr>
<td class="style16">
  
</td>
<td align="right" class="style15">
  
</td>
<td>
  
</td>
<td>
  
</td>
</tr>
<tr>
<td class="style16">
 
</td>
<td align="right" class="style15">
Select Sub Heading : 
</td>
<td>
<asp:DropDownList ID="DropDownList2" runat="server" OnLoad="DropDownList2_Load">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator14" runat="server" ControlToValidate="DropDownList2"
ErrorMessage="Please select sub heading" ValidationGroup="a" InitialValue="Select News Name">*</asp:RequiredFieldValidator><asp:ValidatorCalloutExtender
ID="RequiredFieldValidator14_ValidatorCalloutExtender" runat="server" Enabled="True"
TargetControlID="RequiredFieldValidator14">
</asp:ValidatorCalloutExtender>
<asp:Label ID="Label4" runat="server"></asp:Label>
</td>
<td>
 
</td>
</tr>
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
you do appear to be missing a closing </table> and </div> tag from your content template.
does adding those fix your problem?
edit
Does your javascript console (e.g. firebug in firefox) give you any javascript errors?
Solution to your problem that I assume is:
If validation is failing then DropDownList won't PostBack, so please try once by disabling the Validators on DropDownList.
Some points to note
RequiredFieldValidator should have Display="None" as you are using ValidatorCalloutExtender
Put CausesValidation on the DropDownList and RequiredFieldValidator
It would result in auto triggering the validation on server-side.
Check the Page.IsValid in the SelectedIndexChanged event handler before proceeding any other code parts.

why I am getting old password in a password field in asp.net using C#?

i am making a asp.net website where an user can change password .. by clicking a button changepassword i am redirecting to a new asp page where i have a user code field and a old password filed and a new password field like this:
<table width="100%">
<tr>
<td>
<asp:Label ID="Label5" runat="server" Text="User Code: "></asp:Label>
</td>
<td>
<asp:TextBox ID="txtusercd2" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label6" runat="server" Text="Enter Old Password: "></asp:Label>
</td>
<td>
<asp:TextBox ID="txtoldpwd" runat="server" TextMode="Password"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label7" runat="server" Text="Enter New Password: "></asp:Label>
</td>
<td>
<asp:TextBox ID="txtnewpwd" runat="server" TextMode="Password"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label8" runat="server" Text="Re-Enter New Password: "></asp:Label>
</td>
<td>
<asp:TextBox ID="txtrepwd" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblmsg2" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td style="float:right">
<asp:ImageButton ID="btnchngpwd" runat="server" ImageUrl="~/images/Save.png" />
</td>
</tr>
</table>
now the problem is when i am redirecting to that page my code filed and old password is getting populated by the user login details
i dont want to populate the old password filed . what shold i do?
That's the webbrowser auto-populating it for you. Add the autocomplete="off" attribute to each <input /> element that is being inappropriately filled.

Autocompleteextender and button event not fire in updatepatel

Here In my code I create one user control. Put two textbox with autocompleteextender and submit button. After access two textbox , submit button Click event not fire. What is wrong in code. Please help me.When I put the updatepanel after that it's not working. I need update panel because two textbox autopostback property is true.
<asp:UpdatePanel runat="server" ID="UpQuote" UpdateMode="Always">
<ContentTemplate>
<div id="Quote">
<table>
<tr>
<td class="tbltdForQuote">
</td>
</tr>
<tr>
<td>
<asp:Label runat="server" ID="lblTitle" Text="Get an instant quote" CssClass="lblForQuote"
Font-Size="Large"></asp:Label>
</td>
</tr>
<tr>
<td class="tbltdForQuote">
</td>
</tr>
<tr>
<td>
<asp:Label runat="server" ID="lblTo" Text="Pick-up Location e.g. Heathrow" CssClass="lblForQuote"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:TextBox runat="server" ID="txtTo" AutoPostBack="true" autocomplete="off" CssClass="txtBoxForQuote" />
<ajaxToolkit:AutoCompleteExtender runat="server" BehaviorID="AutoCompleteEx1" ID="autoComplete1"
TargetControlID="txtTo" ServicePath="AutoComplete.asmx" ServiceMethod="GetCompletionList"
MinimumPrefixLength="1" CompletionInterval="1000" EnableCaching="true" CompletionSetCount="20"
CompletionListCssClass="autocomplete_completionListElement" CompletionListItemCssClass="autocomplete_listItem"
CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" DelimiterCharacters=";, :"
ShowOnlyCurrentWordInCompletionListItem="true">
<Animations>
<OnShow>
<Sequence>
<%-- Make the completion list transparent and then show it --%>
<OpacityAction Opacity="0" />
<HideAction Visible="true" />
<%--Cache the original size of the completion list the first time
the animation is played and then set it to zero --%>
<ScriptAction Script="
// Cache the size and setup the initial size
var behavior = $find('AutoCompleteEx1');
if (!behavior._height) {
var target = behavior.get_completionList();
behavior._height = target.offsetHeight - 2;
target.style.height = '0px';
}" />
<%-- Expand from 0px to the appropriate size while fading in --%>
<Parallel Duration=".2">
<FadeIn />
<Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteEx1')._height" />
</Parallel>
</Sequence>
</OnShow>
<OnHide>
<%-- Collapse down to 0px and fade out --%>
<Parallel Duration=".4">
<FadeOut />
<Length PropertyKey="height" StartValueScript="$find('AutoCompleteEx1')._height" EndValue="0" />
</Parallel>
</OnHide>
</Animations>
</ajaxToolkit:AutoCompleteExtender>
</td>
</tr>
<tr>
<td class="tbltdForQuote">
</td>
</tr>
<tr>
<td>
<asp:Label runat="server" ID="lblFrom" Text="Drop-off Location e.g.E1 (Postcode)"
CssClass="lblForQuote"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="txtFrom" AutoPostBack="true" runat="server" autocomplete="off" CssClass="txtBoxForQuote" />
<ajaxToolkit:AutoCompleteExtender runat="server" BehaviorID="AutoCompleteEx" ID="AutoCompletetxtFrom"
TargetControlID="txtFrom" ServicePath="AutoComplete.asmx" ServiceMethod="GetCompletionList"
MinimumPrefixLength="1" CompletionInterval="1000" EnableCaching="true" CompletionSetCount="20"
CompletionListCssClass="autocomplete_completionListElement" CompletionListItemCssClass="autocomplete_listItem"
CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" DelimiterCharacters=";, :"
ShowOnlyCurrentWordInCompletionListItem="true">
<Animations>
<OnShow>
<Sequence>
<%-- Make the completion list transparent and then show it --%>
<OpacityAction />
<HideAction Visible="true" />
<%--Cache the original size of the completion list the first time
the animation is played and then set it to zero --%>
<ScriptAction Script="
// Cache the size and setup the initial size
var behavior = $find('AutoCompleteEx');
if (!behavior._height) {
var target = behavior.get_completionList();
behavior._height = target.offsetHeight - 2;
target.style.height = '0px';
}" />
<%-- Expand from 0px to the appropriate size while fading in --%>
<Parallel Duration=".2">
<FadeIn />
<Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteEx')._height" />
</Parallel>
</Sequence>
</OnShow>
<OnHide>
<%-- Collapse down to 0px and fade out --%>
<Parallel Duration="1">
<FadeOut />
<Length PropertyKey="hight" StartValueScript="$find('AutoCompleteEx')._height" EndValue="0" />
</Parallel>
</OnHide>
</Animations>
</ajaxToolkit:AutoCompleteExtender>
</td>
</tr>
<tr>
<td class="tbltdForQuote">
</td>
</tr>
<tr>
<td>
<asp:Button runat="server" ID="btnQuoteSubmit" Text="Get Quote >>" UseSubmitBehavior="false"
CssClass="QuoteButton" OnClick="btnQuoteSubmit_Click" CausesValidation="false" />
</td>
</tr>
<tr>
<td style="float: right">
<asp:HyperLink runat="server" ID="HyLogin" Text="Login to your account >>"></asp:HyperLink>
</td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
There are two things you can try. 1. Set the AutoPostBack="True" property in your button declaration. Or if that doesn't work, 2. Take the button out of the update panel.
I found the answer after long search. Basically autocompleteextender not working in user control. because they use webmethod and it's only working on web page not user control

Categories

Resources