|
|
How can I handle Null and apply empty string if Null?
<%# IIf(Boolean.Parse(Eval("IsReferralRequired").ToString.Trim()), "Yes", "No")%>
|
|
|
|
|
|
Perhaps, simply by checking the value to be null or not.
if(variable == null) {
variable = String.Empty;
}
You can also set the String.Empty as the default value (value at the declaration stage), and then inside the script-based area you can alter the values.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
here is what I come up with however its replacing DBNull with 'No'. Instead I need to do an empty string. Please help
<%# IIf(IsDBNull(DataBinder.Eval(Container.DataItem, "IsReferralRequired")) OrElse String.IsNullOrEmpty(DataBinder.Eval(Container.DataItem, "IsReferralRequired")) OrElse (Convert.ToBoolean(Eval("IsReferralRequired")) = False), "No", "Yes")%>
|
|
|
|
|
Hi all,
I have an ASP.Net application developed in .Net 4.0. The web app uses around 30 .Net libraries (all custom built within our org.). These were developed about 6 years ago. We have deployed this app recently for a client under a Win 2008 R2 server. The application and all associated .dlls are compiled under 32 bit settings and we have configured the App pool to run under 32 bit too.
The client started complaining of frequent out-of-memory scenarios. The application uses Session extensively to store data. We suggested increasing the server RAM from 4 gigs to 8 gigs. Despite this upgrade, the issue continues to occur.
While I was researching online, I came across the design constraint that w3wp is limited to use only 2GB of addressable memory when running in 32 bit mode. (Article link)
I understand that I have to compile the application and all associated libraries to run under 64 bit.
Meanwhile, I was wondering if increasing the worker process count will help me resolve this issue without modifying the code base. The server has a 8-core processor, hence I could increase the worker processes to 8. I could also enable processor affinity to ensure one request is handled by one wp alone, thereby taking care of session data availability.
Has anyone done something similar? Any guidance is appreciated.
|
|
|
|
|
X86 has a 3.4 gig limit om memory
X64 can go past 4 gigs.
If your using lots of sessions, then the IIS web server is consuming the memory.
So if your session timeout is set to lets say 72 hours, all those sessions will store for 72 hours and then clear.
One thing you can do is set sessions to the sql server, I think its called inproc, to reduce memory consumption.
But you really need to run task manager, and see what's consuming the memory first, is it the ?
AppPool - your app.
IIS Server - probably the sessions, or the IIS settings for your app.
[edit]
Perhaps the OS is consuming the memory?
That's why we run our web servers on the server core with partial GUI.
Our web servers consume about 2 to 3 gigs each, for the whole thing, and we run on X64.
We have 16 gigs in them, and don't even come close to consuming all the RAM.
So we have 3 web servers on each physical server, and we use about 10 gigs total.
[edit2]
We compile on any CPU, so it creates a 32 / 64 dll for X86 and X64
I think back in the day, the X64 only was for Intel Titanium CPU's
modified 27-May-15 15:09pm.
|
|
|
|
|
We decided to run our application as a 64-bit app. We had two options to accomplish this:
Option 1: Compile all component projects targeting 64bit processor. Replace all 3rd party .dlls with their 64 bit versions. Host the application under 64 bit app pool in IIS.
Option 2: Compile all component projects targeting 'Any CPU'. Set the 'LargeAddressAware' option as a post build task. Replace all 3rd party .dlls with their 64 bit versions. Host the application under 64 bit app pool in IIS.
The application renders correctly when we try option 1. Whereas, in option 2, the application has rendering issues. Some of the label controls are not visible in the browser and few buttons appear empty with no text in them. Any idea what could cause this wierd problem?
|
|
|
|
|
You have to look at the HTML that is generated in the browser. So like in Firefox, you right click and inspect element.
Now you see what's missing in the element, and play around with the CSS to make it visible, or perhaps the element is missing altogether now.
So like in the button that's missing text, that should be a input element and the value is the text.
As for fixing the code, I don't know how your generating elements. If your using webforms, or MVC Razor and so forth.
I had that trouble back in 2007 when I went Any CPU, but fixed it. It was just a matter of better coding practices and proper HTML. So the fix was running the page though a HTML Validator and fixing the errors. Most of the errors were element rules, this element can't be inside that element.
On the server side, I was using webforms and server side controls, so I dumped the use of properties like visible, and replace that with CSS display none; to conform more to actual HTML and CSS.
You would have to post the code for the missing element, and show the HTML output from the browser.
[edit]
What kind of server are you running this on?, What CPU? OS
modified 2-Jun-15 12:30pm.
|
|
|
|
|
Message Closed
modified 18-Jun-15 21:06pm.
|
|
|
|
|
|
boolean is bit
what data types are you looking for?
|
|
|
|
|
This is what I was looking for:
public static Type GetClrType(SqlDbType sqlType)
{
switch (sqlType)
{
case SqlDbType.BigInt:
return typeof(long?);
case SqlDbType.Binary:
case SqlDbType.Image:
case SqlDbType.Timestamp:
case SqlDbType.VarBinary:
return typeof(byte[]);
case SqlDbType.Bit:
return typeof(bool?);
case SqlDbType.Char:
case SqlDbType.NChar:
case SqlDbType.NText:
case SqlDbType.NVarChar:
case SqlDbType.Text:
case SqlDbType.VarChar:
case SqlDbType.Xml:
return typeof(string);
case SqlDbType.DateTime:
case SqlDbType.SmallDateTime:
case SqlDbType.Date:
case SqlDbType.Time:
case SqlDbType.DateTime2:
return typeof(DateTime?);
case SqlDbType.Decimal:
case SqlDbType.Money:
case SqlDbType.SmallMoney:
return typeof(decimal?);
case SqlDbType.Float:
return typeof(double?);
case SqlDbType.Int:
return typeof(int?);
case SqlDbType.Real:
return typeof(float?);
case SqlDbType.UniqueIdentifier:
return typeof(Guid?);
case SqlDbType.SmallInt:
return typeof(short?);
case SqlDbType.TinyInt:
return typeof(byte?);
case SqlDbType.Variant:
case SqlDbType.Udt:
return typeof(object);
case SqlDbType.Structured:
return typeof(DataTable);
case SqlDbType.DateTimeOffset:
return typeof(DateTimeOffset?);
default:
throw new ArgumentOutOfRangeException("sqlType");
}
}<pre>
|
|
|
|
|
Why would you want to write a function like that?
I think in the long run, the function will cause more problems than it will solve.
But that's just my opinion.
|
|
|
|
|
Dear friends,
I have planned to develop price comparison website like http://www.mysmartprice.com/mobile/apple-iphone-6-msp4340.
can you please list out here what are the steps and procedure should i follow to develop in that website?. I want to show selected product... other websites price,offer...etc to my website like that website.
|
|
|
|
|
|
I have a console application that self hosts a signalr hub also I have a web client hosted from my IIS server.It works on my local computer and I can open many browsers and send info between them the issue is I see the web client from other computers but the signalr portion is not updating. I believe the issues is how to call the Hub from the remote computer I use IpAdress:port also tried localhost:port but neither work. Any suggestions on self hosting signalr.
|
|
|
|
|
My requirement is to display thumbnail images on to my MVC view. What I am doing here is to convert image to byte array and convert them to base64 string and send this string back to JavaScript.
In JavaScript, I am assigning this base64 string to src attribute of image tag as below
$(img).attr("src", "data:image/png;base64," + data);
This process happened continuously 10 times in a for loop as I need to display 10 images in a page.
When I run this, I am getting half image in IE and showing nothing in Firefox. When I went into fire-fox console I am getting "Image is corrupted or truncated" exception and not sure what it is.
Could anyone throw some light on this issue?
If source code need for any of the said one, please let me know
|
|
|
|
|
Do not re post the same question[^] in different forums. Chose proper forum and post your question there.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Hi All,
I got my organizations web site url and account user name and password for Godaddy, I could able to open the file manager and see the source files there, but to make changes in the web site I want to download the source files and run and see how it is working. I was not given the source application, but the source files are there in the web site at Godaddy luckily.
This is a pretty new organization, so they are not familiar with keeping source application it seems, what I want is I want to download those source files of Database and ASP.Net there on the GoDaddy and make it as an application and then make changes to it before uploading back on to Godaddy, please advise me regarding it, if I am not going in correct direction, I am new to this hosting and uploading.
But when I open the file manager on GoDaddy I am only seeing upload link but not seeing the download link even after selecting the folders, I didn't select file because downloading each file and then managing it in application is little difficult. So I am checking the check box for the folder to download but no luck, please help me with this.
Please any help, suggestion or code snippet of example helps me a lot I am also searching on google how to do it. Thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Connect via FTP using an FTP client and you can download whatever is there. Consult your account on godaddy to find out the host name and credentials. Note that if the site is asp.net and has been compiled you won't easily be able to make changes and recompile as the source files won't be there, the code is in assemblies (dll files). You'd need to decompile them using something like ilspy.
|
|
|
|
|
Hi,
Thank you very much Luckily the aspx.vb files are there in the web site.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Message Closed
modified 16-May-15 21:54pm.
|
|
|
|
|
I have a static class that needs to pass a generic List of strings to a function using an integer as a index to the List in the class. The problem is the static class doesn't have a List collect and I don't have a proper index to access the class in the function it is passed to. The class, the calling code, and the receiving function are below.
My Class:
public class QueryContainer
{
public static QueryContainer Instance = new QueryContainer();
private int _id;
private string _query = "";
private int _searchID;
public QueryContainer() { }
public string Query
{
get
{
if (Instance != null)
return Instance._query;
else
return "";
}
set { _query = value; _id =+ 1; }
}
public int ID { get { return _id; } }
public int SearchID
{
set { _searchID = value; }
get { return _searchID; }
}
}
The calling code:
public int GetAccountSortByAccountCode(int account)
{
int Id = 0;
QueryContainer.Instance.Query = "SELECT ac_sort_order FROM lkup_account_codes where ac_code = " + account.ToString();
return Convert.ToInt32(ExecuteScaler(Id));
}
The function that the static class is passed to:
public int GetAccountSortByAccountCode(int account)
{
int Id = 0;
QueryContainer.Instance.Query = "SELECT ac_sort_order FROM lkup_account_codes where ac_code = " + account.ToString();
return Convert.ToInt32(ExecuteScaler(Id));
}
Corrected <pre> tags to recognise C#, terminators, and indentation.
modified 15-May-15 11:19am.
|
|
|
|
|
Please use <pre> tags around your code, so it is more readable. Also, is this an ASP.NET issue?
|
|
|
|