|
wow.....so easy the syntax.....thx a lot brooo
no my code wont work becoz actually i just put the syntax there to show clearly what is was looking for....
thx 4 ur code......it works perfectly.....
|
|
|
|
|
Imran Khan Pathan wrote:
if(number.ToString().Contains("-"))return 0;elsereturn 1;
I assume you are taking the **** here? Convert a number to a string, checking if the string starts with a 'minus' symbol to determine if it is negative or not?
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
VinothRao wrote: i want the "0" to be return incase NUMBER having negative (exp: -1.236)
i want the "1" to be return incase NUMBER having positive (exp: 1.236)
if (number < 0)
return 0;
else
return 1;
You need to cast number from object type to float before doing checking
|
|
|
|
|
i did that before.......but was encounter error........
Operator '<' cannot be applied to operands of type 'object' and 'int'
Brooo.....after implement ur code into my page.....got some confusion happen with the result....c below....
Grp1 +0.0071
Grp2 0.0001
Grp3 +0.0047
Grp4 +0.0041
Grp5 +0.0038
Grp6 0.0001
Grp7 +0.0005
for the data 0.0005 it has + sign.......but for data 0.0001 dont have....any idea???
Below is the code.
protected string ConvertRM(object number)
{
if (number == DBNull.Value)
return "-";
else
if (number.ToString().Contains("-"))
return String.Format("{0:F4}", number);
else
return String.Format("+{0:F4}", number);
}
|
|
|
|
|
This all looks very bizarre. Please post a sample of the actual data returned from teh database. Don't format it, just post it here as it is stored in the table. You will get a far better solution than the one you are using at the moment.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
the result i given u is part of the actual result taken from db to aspx page...
in aspx page the syntax is :
<asp:label id="Change1" runat="server" text="<%# ConvertRM(DataBinder.Eval(Container, "DataItem.Change")) %>">
i using datagrid to populate the data's.
anything else u need bro??
|
|
|
|
|
the result i given u is part of the actual result taken from db to aspx page...
in aspx page the syntax is :
<asp:Label ID="Change1" runat="server" Text='<%# ConvertRM(DataBinder.Eval(Container, "DataItem.Change")) %>'></asp:Label>
i using datagrid to populate the data's.
anything else u need bro??
|
|
|
|
|
it seems i cant post the aspx tag.....
|
|
|
|
|
VinothRao wrote: Operator '<' cannot be applied to operands of type 'object' and 'int'
You have to cast the object type to float.
protected string ConvertRM(object number)
{
float FNumber = (float)number;
if ( FNumber < 0 )
return "0";
else
return "1";
}
|
|
|
|
|
Compilation was having error after i put up ur code
It says "Specified cast is not valid"......
|
|
|
|
|
ok it seems i found the solution.
protected string ConvertRM(object number)
{
if (number == DBNull.Value)
return "-";
else
if (number.ToString().StartsWith("-"))
return String.Format("{0:F4}", number);
else
return String.Format("+{0:F4}", number);
}
i replace Contains("-") to StartsWith("-")....it looks working....
thxxx 4 d help......
|
|
|
|
|
Your earlier post[^]
I posted an answer here on your earlier post
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
Hi to all,
i have developed one web application with login page. Everything is working well on standalone PC but while on network if somebody logs in with a particular username & password and someone else tries to login on another PC then it automatically logs in with the username of person who is already logged in.
i have used cookies for my login page. Can anybody please tell what is the mistake?
Pravin
|
|
|
|
|
i think the problem is different than cookie as cookies are stored at client side by the browser.
Are you using any static variables or something like that in login page
Again how are you using the cookies in your application ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
I think that there is some problem while creating the application object and session object.
Application object is created for the application(only one) while session objects are created for ecah user separately, that keeps track of the user.
Deepak Nigam
|
|
|
|
|
hi Deepak,
Thanks for reply... can you please tell me how to create session object for each user separately?
or do u have any link for it?
Please reply.
Pravin
|
|
|
|
|
hi,
in the database..i have a field named username(in the table)..........
these values should be displayed in the textboxes(aspx page)......but i dont have the textboxes in aspx page(means i have not created statically)..but these textboxes should be created dynamically ....if the username has three fileds then 3 textboxes has to be generated with username values..
how can i do this ?
Ramesh
|
|
|
|
|
beklo.com/rameshgoudd wrote: .if the username has three fileds then 3 textboxes has to be generated with username values..
3 rows ?
|
|
|
|
|
|
Use a Gridview/DataGrid , put a TemplateColumn and add a TextBox there. Bind Gridview/DataGrid with data from the table. It will give you 3 TextBoxes(depends on no of rows returned).
|
|
|
|
|
take one gridview control and one textbox in ItemTemplte and bind with the dataset.
beSt ReGard
PathAn.
|
|
|
|
|
please give me the code for using checkboxes in dropdown list
its urgent! please help.
alok
|
|
|
|
|
alok2171 wrote: checkboxes in dropdown list
|
|
|
|
|
Well never tried coding it.
But yes..you can find something similar in AjaxToolkit.
Its PopUpControl. I guess its something similar you would like to have.
Hope it helps you
Cheers
Menon
|
|
|
|
|
this is available in C# 3.0 Windows template but i think this is not available with you.
You will have to create your own control by rendering it.
Google the subject you can also find third party controls that you can use
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|