|
Aspx page return the following error
(Valid values are between 1 and 9666, inclusive.Parameter name: year )
when I am trying to Add calander from the tool box.
I am using the following culure in page tage:
UICulture="ar-sa" Culture="ar-SA"
I tried to use the following code in the load page:
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("ar-SA");
System.Threading.Thread.CurrentThread.CurrentUICulture = ci; System.Threading.Thread.CurrentThread.CurrentCulture = ci;
but the same error returned
I adjust the Calander setting from control Panel to Higri calander and then
to grogrian calander but also the same error returne.
thanks in Advance
Mohammed Ibrahim
|
|
|
|
|
You shouldn't have this problem. Hijri year values are 600 years less than Gregorian.
Can you capture what value is going in? My guess is that nothing or null is being input and its getting casted into a 0 which would break the rule. You should set the default to DateTime.Now.Year.
If that's not the case, post back, but include the value being input and the snippet where its being handled.
|
|
|
|
|
|
I am not Passing any date what I am doing is
adding Clander control from the tool box
then writing the following lines in page load event:
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("ar-SA");
Thread.CurrentThread.CurrentUICulture = ci;
Thread.CurrentThread.CurrentCulture = ci;
System.Threading.Thread.CurrentThread.CurrentCulture = ci;
System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
then I am getting the following error:
Server Error in '/COEIA' Application.
--------------------------------------------------------------------------------
Valid values are between 1 and 9666, inclusive.
Parameter name: year
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentOutOfRangeException: Valid values are between 1 and 9666, inclusive.
Parameter name: year
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentOutOfRangeException: Valid values are between 1 and 9666, inclusive.
Parameter name: year]
System.Globalization.HijriCalendar.CheckYearRange(Int32 year, Int32 era) +2315381
System.Globalization.HijriCalendar.GetDaysInYear(Int32 year, Int32 era) +20
System.Globalization.HijriCalendar.GetDatePart(Int64 ticks, Int32 part) +234
System.Globalization.HijriCalendar.GetYear(DateTime time) +26
System.Web.UI.WebControls.Calendar.IsTheSameYearMonth(DateTime date1, DateTime date2) +73
System.Web.UI.WebControls.Calendar.EffectiveVisibleDate() +163
System.Web.UI.WebControls.Calendar.Render(HtmlTextWriter writer) +89
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +163
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +51
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266
Mohammed Ibrahim
|
|
|
|
|
Hi. got a project where you enter details for an order, name, address, city, state, zip code, description, quantity, weight and price, then you click the add this button, which adds individual items to an order. then it calculates individual items. then you click the up date summary button, and then calculate all items for the entire order. then it displays the dollar amount, sales tax, if shipped to a california address, and is 8% of the total price, shows the shipping charge for a given weight. and then the total amount. the problem, is not showing the correct dollar amount, sales tax, if i put in the state which is:
CA, not showing the correct amount. what am i doing wrong? can any one help me to get this working? any suggestions, code samples, code snippets would be fine. cheers Marvin.
'Program: VBMail
'Programmer: Marvin Hunkin
'Date: Tuesday Febuary 24 2009
'Description: Keep track of mail orders
Partial Class VBMail
Inherits System.Web.UI.Page
'Declare Constants
Const Handling As Decimal = 0.25
'Declare Module Level Variables
Dim intTotalWeightShipped As Integer = 0
Dim decTotalPriceCharged As Decimal = 0.0
Protected Sub btnAddThisButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddThisButton.Click
'Declare Variables
Dim intItemQuantity As Integer = 0
Dim intItemWeight As Integer = 0
Dim intTotalOrderWeight As Integer = 0
Dim decItemPrice As Decimal = 0.0
Dim decTotalOrderPrice As Decimal = 0.0
Dim decShippingCharge As Decimal = 0.0
Dim decHandling As Decimal = 0.0
Dim decTax As Decimal = 0.0
Dim decTotalAmount As Decimal = 0.0
'Convert Variables
intItemQuantity = integer.parse(tbQuantityTextbox.Text)
intItemWeight = integer.Parse(tbWeightTextBox.Text)
decItemPrice = decimal.parse(tbPriceTextBox.Text)
'Calculate Items
decTotalOrderPrice = intItemQuantity * decItemPrice
intTotalOrderWeight = intItemQuantity * intItemWeight
decTotalPriceCharged = decTotalPriceCharged + decTotalOrderPrice
intTotalWeightShipped = intTotalWeightShipped + intTotalOrderWeight
tbPriceTextBox.Text = decItemPrice.ToString("C")
tbNameTextBox.Focus()
End Sub
Protected Sub btnClearButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnClearButton.Click
'Clear Text Boxes
tbNameTextBox.Text = ""
tbAddressTextBox.Text = ""
tbCityTextBox.Text = ""
tbStateTextBox.Text = ""
tbZipCodeTextBox.Text = ""
tbDescriptionTextBox.Text = ""
tbQuantityTextBox.Text = ""
tbWeightTextBox.Text = ""
tbPriceTextBox.Text = ""
tbDollarAmountTextBox.Text = ""
tbSalesTaxTextBox.Text = ""
tbShippingChargeTextBox.Text = ""
tbTotalAmountTextBox.Text = ""
decTotalPriceCharged =0.0
intTotalWeightShipped = 0
tbNameTextBox.Focus()
End Sub
Protected Sub btnSummaryButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSummaryButton.Click
Dim strState As String = "CA"
Dim intItemWeight As Integer = 0
Dim intTotalOrderWeight As Integer = 0
Dim decTotalOrderPrice As Decimal = 0.0
Dim decItemPrice As Decimal = 0.0
Dim decShippingCharge As Decimal = 0.0
Dim decTotalAmount As Decimal = 0.0
'Check For shipping Charge
If intTotalWeightShipped < 10 Then
decShippingCharge = 1.0
ElseIf (intTotalWeightShipped > 10) And (intTotalWeightShipped <= 100) Then
decShippingCharge = 3.0
ElseIf intTotalWeightShipped > 100 Then
decShippingCharge = 5.0
End If
' Calculate Tax
Dim decTax As Decimal = 0.0
If tbStateTextBox.Text = "CA" Then
decTax = decTotalPriceCharged * 0.08
Else
decTax = 0.0
End If
'Calculate Total Order
Dim decTotalAmountWithExpenses As Decimal = 0.0
decTotalAmountWithExpenses = decTotalPriceCharged + decTax + decShippingCharge
'Format Text Boxes
tbDollarAmountTextBox.Text = decTotalPriceCharged.ToString("C")
tbSalesTaxTextBox.Text = decTax.ToString("C")
tbShippingChargeTextBox.Text = decShippingCharge.ToString("C")
tbTotalAmountTextBox.Text = decTotalAmountWithExpenses.ToString("C")
tbNameTextBox.Focus()
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Declare Variables
Dim strState As String = "CA"
Dim intItemWeight As Integer = 0
Dim intTotalOrderWeight As Integer = 0
Dim decTotalOrderPrice As Decimal = 0.0
Dim decItemPrice As Decimal = 0.0
Dim decShippingCharge As Decimal = 0.0
Dim decTotalAmount As Decimal = 0.0
'Check For shipping Charge
If intTotalWeightShipped < 10 Then
decShippingCharge = 1.0
ElseIf (intTotalWeightShipped > 10) And (intTotalWeightShipped <= 100) Then
decShippingCharge = 3.0
ElseIf intTotalWeightShipped > 100 Then
decShippingCharge = 5.0
End If
' Calculate Tax
Dim decTax As Decimal = 0.0
If tbStateTextBox.Text = "CA" Then
decTax = decTotalPriceCharged * 0.08
Else
decTax = 0.0
End If
decTax = session("SavedSalesTax")
'Calculate Total Order
Dim decTotalAmountWithExpenses As Decimal = 0.0
decTotalAmountWithExpenses = decTotalPriceCharged + decTax + decShippingCharge
decTotalAmountWithExpenses = session("SavedTotalAmountWithExpenses")
session("SavedTotalPriceCharged ") = decTotalPriceCharged
session("SavedSalesTax") = decTax
session("SavedShippingCharge") = decShippingCharge
session("SavedTotalAmountWithExpenses") = decTotalAmountWithExpenses
End Sub
End Class
|
|
|
|
|
Wow - seems like you have a lot of homework problems...
Why on earth are you saving this stuff in the session ? I would think that one thing you need to check now, is if your session value gets set in several places and is getting stomped. Don't use the session needlessly.
Your first step should be to use the debugger to step through and see if the code is executing as you'd expect. Is tbStateTextBoxes text coming back as CA ? Perhaps you need to use the trim() method to remove a space or two ? A combo box of states would work better than free text, what if someone types 'California', or even 'Cal' or ' CA ' ?
Then, if you can't work it out, post about what you did to try to work it out and post just the relevant code, not so much that we need an hour to work it all out.
I suspect your problem is that you calculate tax first, before the amount you multiply by .08 has a value other than zero. At the core, you need to learn to use the debugger.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi. got a project where you enter a number of tickets, the number of tickets, and then if you add a check box, the code for the credit card, then select from a combo box. the general price for this event is $15 and the awards ceremony is $25. then the hyper link is invisible until you click the submit button, which then will give the user a wecome message, and the general details. then the hyperlink is visible agaion. my problems, and questions are. know how to evaluate a checkbox and radio buttons, but how to evaluate a checkbox with a variable, then add that to the calculation. 2. to help me get the correct calculations. 3. to help me fix the errors. will paste below. any help, suggestions, or code snippets or samples would be fine. cheers Marvin.
'Program: Tickets
'Programmer: Marvin Hunkin
'Date: Monday Febuary 23 2009
'Description: Selling tickets For A Rodeo
Partial Class Tickets
Inherits System.Web.UI.Page
Protected Sub btnSubmitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmitButton.Click
'Declare Variables
dim decTickets as Decimal = 15
dim decAwards as Decimal = 25
dim decAmountDue as Decimal = 0.0
dim intCounter as Integer = 0
dim tbNumerTextbox as TextBox
dim tbAmountDueTextBox as TextBox
dim decTotalAmount as decimal = 0.0
'Add One to Counter
intCounter += 1
'Calculate Total amount
decAwards = 25
if chkAwardsCheckBox.Checked = True
decTotalAmount =decAmountdue * decTickets + decAwards
else
decTotalAmount = decAmountDue + decTickets
end if
'Format Text Boxes
tbNumerTextbox.text = intCounter.ToString()
tbAmountDueTextBox.text = decAmountdue.ToString("C")
tbNumberTextBox.Focus
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
if ispostback then
'Do Nothing
else
dim liItemOnetext as New ListItem
dim cboCreditCard as DropDownList
liItemOne.text= "VISA"
liItemOneltext = "AMEX"
liItemOneltext= "MasterCard"
cboCreditCard.items.add(liItemOne)
end if
dim intCounter as Integer = 0
dim decTickets as Decimal = 15
dim decAwards as Decimal = 25
dim decAmountDue as Decimal = 0.0
dim tbNumberTextbox as TextBox
dim tbAmountDueTextBox as TextBox
'Display Information
intCounter = session("savedNumberOftickets")
decAmountDue = session("savedAmountDue")
decAmountdue = decTickets + decAwards
session("SavedNumberOfTickets") = intCounter
session("SavedAmountDue") = decAmountDue
End Sub
end class
b
|
|
|
|
|
Again, you are overusing the session object. Why ?
Are you trying to work through a book, or is this homework ? If it's homework, I'm surprised you have several projects at once. You're obviously a beginner, try to stick to one project until you understand the issues related to that, before moving on.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
HI. well the programming book example, showed me about session variables, so need to use this for this exercise and how to get it to work, and also, got errors,, using variables, before it has been assigned. so need help or code snippets how to do this. not to do it for me, but to help me how to fix the errors, and how to maybe sample code to evaluate a checkbox and a variable. and how to invoke the link to be invisible, then when i calculates, then to display the link again and make it visible. well need session variables, to dhow the total amount and the number of tickets people purchased. so sorry about this. cheers and get bakc to me asap.
|
|
|
|
|
Hi. forgot to add, yes working through a programming book. cheers Marvin.
|
|
|
|
|
HI. a blind programming student from Australia and use the jaws for windows screen reader from http://www.freedomscientific.com. my problem is, the project is a standard login form in visual web developer express 2005. and the user types in their name, e-mail, user name, password, then confirm password. if the 2 passwords match, then a label with a welcome message and the name of the user taken from the text box. if you do not have the passwords matching, you get an error message. now, for some stupid reason jaws is not reading me the welcome message and the user name. so wondering, what am i doing wrong? how to get this to read correctly. any access technology specialists or users, who are blind or vision impaired here on this forum. will paste the code for the project below. any ideas, suggestions or work arounds or fixes are welcome. cheers Marvin.
'Program: Login
'Programmer: Marvin Hunkin
'Date: Monday Febuary 23 2009
'Description: Login Form and compare two password strings
Partial Class Login
Protected Sub btnSubmitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmitButton.Click
'Declare Variables
Dim strPassword As String = "Password"
Dim strConfirmPassword As String = "Password"
'If password and confirm passwords are same, then display welcome message
If tbPasswordTextBox.Text = tbConfirmPasswordTextBox.Text Then
lblMessageLabel.Text = "Hello " & tbNameTextBox.Text & ""
Else
tbPasswordTextBox.Text = ""
tbConfirmPasswordTextBox.Text = ""
lblMessageLabel.Text = "The Passwords You entred do Not Match! Please Try Again!("")"
tbNameTextBox.Focus()
End If
End Sub
End Class
|
|
|
|
|
StarTrekCafe wrote: now, for some stupid reason jaws is not reading me the welcome message and the user name. so wondering, what am i doing wrong? how to get this to read correctly.
I didn't get what is your actual problem. Its seems working fine.
BTW : How this question comes into ASP.NET Forums.
As you are new in CP, please read the forum guideline. and post in proper forum.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Abhijit Jana wrote: I didn't get what is your actual problem
I'm guessing the HTML output is not accessibility compliant as his screen reading software doesn't read part of the the content on the web page.
Abhijit Jana wrote: How this question comes into ASP.NET Forums.
Because he is asking about what he did wrong in making the ASP.NET page accessibility compliant.
Abhijit Jana wrote: and post in proper forum
As far as I can see he is posting in the proper forum.
|
|
|
|
|
HI. well my problem is my screen reader is not reading me that welcome message and the name of the user, and it does relate to asp dot net, because that was one of the exercises in the web programming chapter of the vb programming book. now, wondering, if it being hidden by some type of thing, and wonder if i need to use a separate text box or status bar. cheers Marvin.
|
|
|
|
|
this is my code
public decimal OrderTotal;
SqlParameter parameterOrderTotal = new SqlParameter("@OrderTotal", qlDbType.Money);
parameterOrderTotal.Direction = ParameterDirection.Output;
myCommand.SelectCommand.Parameters.Add(parameterOrderTotal);
retreive this value by
myOrderDetails.OrderTotal = (decimal)parameterOrderTotal.Value;
some times ite work fine but sometime its show errror Specified cast is not valid.
Tahnx
|
|
|
|
|
You need to check for a null value (or DBNull.Value) before casting it.
|
|
|
|
|
I am using Grid View control in asp.net (3.5). I am passing Grid View value from one page to another. In another page i want to edit that value. I am facing a problem while editing as it's retaining old value in Update command.
Pls. help
modified on Sunday, March 15, 2009 4:23 AM
|
|
|
|
|
OK, so you expected to post this in the VB forum and get help ? Wow. Even now, I don't see how we can help you. What value are you passing ? How are you passing it ? Why are you editing the value in the new page ? What do you mean, it's retaining the old value ? You haven't given anything like an explanation that gives us info we need to try to understand and help you.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
maybe a little bit of code and value parameters will help you more
|
|
|
|
|
hello sir/madam
i have following code for updating database via datagrid control,,but it produces an error..can anybody tell me how to deal with this kind of error..
]]>
]]>
SqlConnection connector = new SqlConnection(@"Server=localhost;Integrated Security=SSPI;Database=cms");
String strsql;
void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
BindDataGrid();
}
void BindDataGrid()
{
SqlCommand cmdsql = new SqlCommand("Select * from studentmarksentry", connector);
connector.Open();
unittest1marksentry_datagrid.DataSource = cmdsql.ExecuteReader();
unittest1marksentry_datagrid.DataBind();
connector.Close();
}
void CancelCommand(Object sender, DataGridCommandEventArgs e)
{
unittest1marksentry_datagrid.EditItemIndex = -1;
BindDataGrid();
}
void EditCommand(Object sender, DataGridCommandEventArgs e)
{
unittest1marksentry_datagrid.EditItemIndex = e.Item.ItemIndex;
BindDataGrid();
}
void UpdateCommand(Object sender, DataGridCommandEventArgs e)
{
int regd_num;
String txtvalueholder;
if (IsValid)
{
regd_num=(int)unittest1marksentry_datagrid.DataKeys[e.Item.ItemIndex];
TextBox txtmarksentry = (TextBox)e.Item.FindControl("txtmarksentry");
txtvalueholder = txtmarksentry.Text;
strsql = "update studentmarksentry set MarksObtained=@marksentry where Regdno=@register";
SqlCommand cmdsql = new SqlCommand(strsql, connector);
cmdsql.Parameters.Add("@marksentry", txtvalueholder);
cmdsql.Parameters.Add("@register", regd_num);
connector.Open();
cmdsql.ExecuteNonQuery();
connector.Close();
unittest1marksentry_datagrid.EditItemIndex = -1;
BindDataGrid();
}
}
<title>Unit-Test 1 marks Entry form
<asp:datagrid id="unittest1marksentry_datagrid" autogeneratecolumns="false" oncancelcommand="CancelCommand" oneditcommand="EditCommand" xmlns:asp="#unknown">
OnUpdateCommand="UpdateCommand" runat="server">
<columns> <asp:boundcolumn headertext="Register No" datafield="Regdno" readonly="true">
<asp:boundcolumn headertext="First Name" datafield="First name" readonly="true">
<asp:boundcolumn headertext="Middle Name" datafield="Middle name" readonly="true">
<asp:boundcolumn headertext="Last Name" datafield="Last name" readonly="true">
<asp:templatecolumn>
<headertemplate>
Marks Obtained
<itemtemplate>
<%#DataBinder.Eval(Container.DataItem,"MarksObtained") %>
<edititemtemplate>
<asp:textbox id="txtmarksentry" text="<%#DataBinder.Eval(Container.DataItem," marksobtained")="" %>"="">
runat="server">
<asp:comparevalidator id="unittest1marksentry_comparevalidator" controltovalidate="txtmarksentry">
Display="Dynamic" Text="must be a number" Operator="DataTypeCheck" Type="Integer"
runat="Server">
<asp:editcommandcolumn edittext="Edit" updatetext="Update" canceltext="Cancel">
here my database name is cms and try to update the marks obatined column but i get following error
:Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
ok
waiting for the reply.
|
|
|
|
|
Buy a basic programming book and read it. Don't post so much code that no-one will bother reading it.
rosae619 wrote: :Index was out of range. Must be non-negative and less than the size of the collection.
It means what it says. Look at the code where the debugger breaks. Is index < 0, or greater than the collection ? Never access a collection without first making sure the index you're about to use is valid. Read error messages, and then think about what they say. They mean what they say.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
this is my question i want to put the functionality of onblur method of textbox is not in javascript but in c# but i am unable to find any similar or working functionality.
-------------------xxx-----Have any ideas----------------xxxxxxxxxxx-------------------
thanks.
|
|
|
|
|
There's a reason for this. The reason is that it would be idiotic for this to exist. You need to understand how web applications work, and you plainly do not. A web page that reloaded itself every time a textbox lost focus, would really, really suck. You can use C# code by making an AJAX call, assuming you know anything about AJAX.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
can you please more clarify it ..well i have ajax tools and extenders but dont know which one to use and any article for me is more helpful.
|
|
|
|
|
Alok sharma ji wrote: well i have ajax tools and extenders
Put your textbox inside an updatepanel. Set AutoPostBack=true and hook the TextChanged event handler. You can see the event fires on blur.
|
|
|
|
|