|
It is always best practice to convert object with Convert.ToString(Request.QueryString["username"]) instead of .ToString().Check whether you are getting username value as null.
Life Is Beautiful
|
|
|
|
|
Since Request.QueryString[key] already returns a string , there's absolutely no need to call either Convert.ToString or .ToString() to convert it to a string.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Just drop the .ToString() call - Request.QueryString["username"] already returns a string .
username = Request.QueryString["username"];
You also need to HTML-encode the value before you display it, to avoid cross-site scripting (XSS)[^]:
lbluname.Text = "Welcome :" + HttpUtility.HtmlEncode(username)
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Object reference not set to an instance of an object. it really means that when you request this page ,you haven't passed a param in the request. why not check the former page which entry this one?
|
|
|
|
|
Is the value "username" correctly being passed in the querystring. The statement "Request.QueryString["username"].ToString();" is not getting the value from the querystring hence the error
|
|
|
|
|
Is there a way to embed an image in a datagrid without using url in a image tag? I want to embed an image in a telerik radgrid so i can export it to excel with the actual image. I tried data uri but excel does not support it. Any Ideas?
|
|
|
|
|
I ought to redirect my website from non-www to www on IIS 6. e.g if I enter domain.com in the url, it has to redirect to www.domain.com for SEO optimization.
I followed the video "http://www.youtube.com/watch?v=PYxabNrIMQ4" for creating my rewrite rule. And I made it as below
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to www" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{HTTP_HOST}" pattern="mydomain.com" />
</conditions>
<action type="Redirect" url="http://www.mydomain.com/{R:0}" />
</rule>
</rules>
</rewrite>
But it is not working as expected. Help me out to find the solution.
Note: My Visual studio shows warning like "The element 'system.webServer' has invalid child element 'rewrite'".
I believe it doesn't make any problem.
|
|
|
|
|
|
Hi Friends,
I have DropdownList, Textbox and RegularExpression Validator in Gridview's ItemTemplate. RegularExpressionValidator is to validate the percentage in Textbox entry.
This RegularExpressValidator should enable only based on dropdownlist selection. i.e., if dropdownlist selection is "Percentage" then, validator should enable to validate textbox entry.
I have tried many ways in Javascript and .cs code, but no luck.
Please help in this.
Regards,
Priyaa.
|
|
|
|
|
Replace you RegularExpression Validator with a Custom Validator, then you can use string.match js method to validate you textbox.
here is a link on how to use the string.match() method:
string.match()
|
|
|
|
|
Hi,
you can use dropdown selected index changed event on dropdownlist.
means if your regular expression validator id is regular1 then just false its visibility from server side as reqular1.Visible=false;
try it.
this can also done by Jquery.
|
|
|
|
|
|
i am having the problem with insert / update nvarchar model data in Entity Framework ( Asp.net 4.0 - MVC 4 )
In SQL Server 2008, i have "PhoneNo" [nvarchar(60)] column in UserInfo table.
Via Entity framework i can able to update from 1 to 30 characters only (which means 50% in that datatype. if length is 100, i can able to save from 1 to 50). Suppose if i give more than 30 chars then throws exception.
{"String or binary data would be truncated.\r\nThe statement has been terminated."}
Note: Using sql server query i can able to save upto 60 chars. but entity framework i can't.
Please provide me the solution for this issue.
Thanks in advance.
With Regards
Ganesan.M
|
|
|
|
|
Hey all
Hope someone could help with some advice i am considering building a site where users can read reviews on different products. Also i would like to create a mobile platform to allow users, on the go, to read reviews.
But i am a bit lost in relation to how the system should be build, either i should build from scratch this would give me complete control but also in my view be very time consuming, or should i use Umbraco as base of for my site?
If i choose umbraco should i create my own tables for product storage or use umbraco's document type, here i am thinking about how to later extract data using a web service.
any input would be appreciated
|
|
|
|
|
Edit GridView Row not working when new row is inserted on GridView RowCreated
Requirement:
Display data in a GridView Control
1. Group by particular column called "Region"
2. Also display total sum of revenue for each region
3. Column called "Remarks" should be editable
Problem:
I am unable to edit the Column
(since i have inserted rows which displays sum for each region)
The Row Edit index gets updated due to which i am facing this problem
Solutions Tried:
Created a template field with a button in it (Still not able to Edit)
Request the members to help me on this.
|
|
|
|
|
Dear all,
I am currently beginner into this web api applications. I require a little help in how do I go about retrieving previous day's data using entity framework from 'GET' method.
I have constructed the following the code but I cannot get seem to get it work:
The following code is in the WIC controller class.
public database_WICs Getdatabase_WICs(DateTime UploadDate)
{
database_WICs database_wics = db.database_WICs.Find(UploadDate);
string yesterday = DateTime.Today.AddDays(-1).ToShortDateString();
if (database_wics == null)
{
throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
}
return database_wics;
}
Any help would be very much appreciated.
Thank you
|
|
|
|
|
Quote:
string yesterday = DateTime.Today.AddDays(-1).ToShortDateString();
What this line for?
You mean to do this before and pass yesterday to the db?
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is (V).
|
|
|
|
|
Thank you for your reply.
I changed the above line to the following below:
string yesterday = db.database_BWICs.Find(d => d.UploadDate == yesterday);
Whenever I add
db.database_WICs.Find(d => d.UploadDate == yesterday
I get the following error in the code:
"Cannot convert lambda expression to type 'object[]' because it is not a delegate type."
I can not seem to figure out why.
Any help would be very much appreciated.
Thank you
|
|
|
|
|
To check it I need the signature of db.database_WICs.Find method...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is (V).
|
|
|
|
|
Hello, thank you for your response.
I apologies for the late response, by signature you mean the entire api control class or the database model code.
Thanks
|
|
|
|
|
By signature I mean the types of its parameters and return value.
See here http://en.wikipedia.org/wiki/Type_signature[^]
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is (V).
|
|
|
|
|
Thank you so much for your response. Here is the data model with all its parameters:
namespace Wic_T1
{
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
[DataContract]
public partial class database_WICs
{
[DataMember]
public int ID { get; set; }
[DataMember]
public string Name { get; set; }
public Nullable<System.DateTime> SaleDateTime { get; set; }
public string Region { get; set; }
[DataMember]
public string CUSIP { get; set; }
[DataMember]
public string Size__m_ { get; set; }
public string OriginalRating { get; set; }
public Nullable<System.DateTime> MaturityDate { get; set; }
public string Manager { get; set; }
[DataMember]
public string priceTalk { get; set; }
[DataMember]
public string Cover { get; set; }
public Nullable<System.DateTime> LastUpdated { get; set; }
[DataMember]
public Nullable<System.DateTime> UploadDate { get; set; }
[DataMember]
public string Type { get; set; }
[DataMember]
public string ISINs { get; set; }
[DataMember]
public Nullable<float> Decimal_price { get; set; }
public string CMBS_spread { get; set; }
public Nullable<float> CMBS_decimal { get; set; }
[DataMember]
public string Current_size { get; set; }
}
}
I really appreciate your time and help.
|
|
|
|
|
It seems that, that was not enough.
Do we talk about a big project? Or can you zip it all and send me to peter@rashim.co.il?
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is (V).
|
|
|
|
|
Apology for the late response.
I partially go the code to work. as it now display's yesterday's data feed.
However, I have weekday dates data stored on server and when I call data from now.date Monday, I get a null list on the client-side.
Is their any example, where I can use to get yesterday's date data excluding weekend dates?
<pre lang="c#">public IEnumerable<database_BWICs> GetDate()
{
DateTime yesterday = DateTime.Today.AddDays(-1);
var data = from c in db.database_BWICs
where c.UploadDate == yesterday
select c;
return data.ToList();
}
Thank you so much for your support and generous gesture.
I really appreciate your time and help.
|
|
|
|
|