|
hi all,
I am ASP.NET (C#) developer.I want a suitable method for finding whether a string is float or integer or date or like this.
So kindly provide me some suitable method and some website link related to this.
Thank You.
Rahul (from india)
"Every thing matters in this world but what you think,it matters more.
When thinking changes,the whole world changes."
|
|
|
|
|
hi,
if you are a C# programmer, you should be able to create your own function that will check the type. you could use the try-catch block to convert it to the desired type. if it completes with a success, you know it is of the right type.
regards
|
|
|
|
|
The int.TryParse and float.TryParse static methods are useful for this.
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
C++ to C# Converter: converts C++ to C#
Instant C++: converts C# to C++/CLI and VB to C++/CLI
Instant Python: converts C# to IronPython and VB to IronPython
|
|
|
|
|
One technique you can use is to include the Microsoft.VisualBasic dll and use the 'IsNumeric()' method.
Just add a reference to the Microsoft.VisualBasic (assuming .NET 2.0 and assuming you've installed VB.NET) and then you can do this:
Microsoft.VisualBasic.Information.IsNumeric("123");
Microsoft.VisualBasic.Information.IsDate("3/21/2007");
There are other available methods so you can review to see if any fit your needs...
-Don
|
|
|
|
|
I have a text box if it is empty also i have to add it to the database How is it possible.
|
|
|
|
|
hi,
try the following:
dim i as integer = iif(textbox1.Text="",0,textbox1.Text)
please note that it will not check if it is of type integer or not, for that you can use validators.
regards
|
|
|
|
|
Hi in my project in default.aspx page i have used frame set...,
In that 2 frame set, one header frame i used html link buttons.., if we click the link buttons in another frameset html page i target aspx page will be display,
In my gloabl.aspx page i said if session will be end go to login.aspx page like...,
When the session will be end its going to login.aspx page..,
In my login.aspx page no frame set,but there header frame is displaying,
now how to said when the session will be end that header frame also want to end like...,
Plz any one hlp me...,
Magi
|
|
|
|
|
Hi
It is not the problem with session(your subject).
The problem is how you are redirecting to login page(I think So..).
Can you post it.
To succeed, we must first believe that we can.
Sherin Iranimose
|
|
|
|
|
Try the following code to redirect
<br />
Response.Write("<script language='javascript'>")<br />
Response.Write("window.open('login.aspx','_top')")
Response.Write("</script>")<br />
To succeed, we must first believe that we can.
Sherin Iranimose
|
|
|
|
|
hi
I didn't ask this.
How you are redirecting to login page?
What code you are using for that?..
did you try the above coding(that i already given) for redirecting to login page?
To succeed, we must first believe that we can.
Sherin Iranimose
|
|
|
|
|
Ya thanks lot,
Its working paka,
Once again thanks lot...,
Keep in touch
Magi
|
|
|
|
|
You're welcome.........
To succeed, we must first believe that we can.
Sherin Iranimose
|
|
|
|
|
hi,
i want to replace the message [Java Applcation]from the confirm box.
i have implmented a confirmation on a button click as shown below.
Button1.Attributes.Add("onClick","return confirm(Do you want to quit?')");
Its working but im not able to edit the title of the popup window. If anyone have any idea or any alternative method than this..pls help me.
Thanks in advance
arun
|
|
|
|
|
|
Hello
I add on the crystal reports picture from the table and then I like export to pdf and they show error
ERROR DETECTED BY EXPORT DLL
Is any idea what is wrong
thank you
|
|
|
|
|
I keep getting this error when trying to read items from my shopping cart session. I've tracked it down to the foreach loop I am doing.
Unable to cast object of type 'BasketItem' to type 'BasketItem'.
Exception Details: System.InvalidCastException: Unable to cast object of type 'BasketItem' to type 'BasketItem'.
foreach (BasketItem theItem in items)<br />
{<br />
count++;<br />
total += theItem.ReturnTotal();<br />
}
items is defined as this:
ArrayList items = (ArrayList)Session["shoppingCart"];
Session["shoppingCart"] is defined as the ArrayList cartArray:
ArrayList cartArray;<br />
Session["shoppingCart"] = cartArray;
The BasketItem class is a protected class with a string, an int, and 2 doubles that holds information about the product and price.
I checked the session to make sure the data is in it correctly. It seems to be fine because I can get the data out of the session and bind it to a datagrid with no issues. For some reason it doesn't like me doing a foreach loop.
This works fine:
ArrayList items = (ArrayList)Session["shoppingCart"];<br />
GridView2.DataSource = items;<br />
GridView2.DataBind();
I am lost on this one and hope someone can provide some insight. Thank you.
|
|
|
|
|
InvalidTypecast wrote: Exception Details: System.InvalidCastException: Unable to cast object of type 'BasketItem' to type 'BasketItem'.
Represents the error that occurs when an explicit conversion (casting operation) fails because the source type cannot be converted to the destination type.
InvalidCastException Class[^]
Regards,
Satips.
|
|
|
|
|
I understand the error, but I just can't figure out why it can't convert. It seems like it should.
|
|
|
|
|
what does cartArray points to?
try this:
foreach (Object theItem in items)
{
count++;
total += ((BasketItem)theItem).ReturnTotal();
}
Regards,
Arun Kumar.A
|
|
|
|
|
Thanks everyone. I figured it out. I believe what I was doing wrong was declaring the BasketItem class in Default.aspx.cs and Default2.aspx.cs (where I was reading the session passed from Default.aspx). I moved the class into the AppCode folder into its own .cs file, commented out the class definition from the other two cs files, and the problem went away.
|
|
|
|
|
Still why your name "InvalidTypecast" is unaltered?
;);)
Regards,
Arun Kumar.A
|
|
|
|
|
Still he he could not get any other Name it seems.
Regards,
Satips.
|
|
|
|
|
;);)
Regards,
Arun Kumar.A
|
|
|
|
|
|
Hi All,
I have strange problem when I want to load crystal report XI Developer Edition Report file using MS VS 2005 (C#) through code as follows and i am using XML as a data source. I fill dataset
by reading Xml files.
ReportDocument customerReport = new ReportDocument();
customerReport.Load(Path);
customerReport.SetDataSource(ds);
CrystalReportViewer1.ReportSource = customerReport;
Error Message is :
Failed to load database information. Details: The database DLL 'crdb_xml.dll' could not be loaded. Error in File C:\WINDOWS\TEMP\Group Selection {297712F6-C0E6-466E-9696-B75CBDDB9915}.rpt: Failed to load database information
Ala Qunaibi
):
|
|
|
|