ADO.NET :: Determining Presence Of Specific Value
Feb 10, 2011
I am unsure how to quickly check a set of returned values for a specific value. Given the following:
[Code]....
I then want to check all the returns values in locs for a specific value. I know I could build a foreach loop that would walk through every return data value in locs to see if it matched, but I was hoping to use something simpler.
[Code]....
I tried to search for this already as I am sure it has been asked before, but I apparently lack the proper search keywords.
View 2 Replies
Similar Messages:
Mar 9, 2011
where does following HTTP error message come from:
Due to the presence of characters known to be used in Cross Site Scripting attacks, access is forbidden. This web site does not allow Urls which might include embedded HTML tags.
We're using dynamically generated URLs and in this specific case the URL contains the characters '<' or '>'. We do URL encode the generated URL (so '%3C' appeary instead of '<') but it doesn't Our setup is ASP.NET MVC / IIS 7.5 / IE8. It's strange but it looks like the error appears only on some machines. So it could be that the IE internet zone settings are playing a role.
View 1 Replies
Jun 29, 2010
The onclick event of the image (that shoud show the OC dropdown) is not working in this scenario: The page has OC precense indicator then a modal window that has OC precence indicator is launched. When the modal window is closed and there is no postback on the parent page, the OC dropdown of the parent page does not show when the image is clicked. The onclick event is working well if the parent page had a full postback after closing the modal window. How will I fix the onclick event issue if there is no poastback?
View 1 Replies
Mar 9, 2011
I am currently developing a site for my OJT.I have created a login form for my site now I got confused on what to do with this one. I need to identify if the user has been log-in or log-out As the user inputted the exact username and password it will go to this line of codes in which will identity if the user has bees signout or not.
HttpCookie cookie = new HttpCookie("isLog");
cookie.Value = "1";
DateTime dtNow = DateTime.Now;
TimeSpan tsMinute = new TimeSpan(1, 1, 0, 0);
cookie.Expires = dtNow + tsMinute;
Response.Cookies.Add(cookie);
Response.Redirect("manageService.aspx");
And I have this function to determine if the user has been log-in or log-out.
protected Boolean isLog()
{
//String strCookieName = Request.QueryString["cookie"].ToString();
//Grab the cookie
HttpCookie cookie = Request.Cookies["isLog"];
String tmp = cookie.Value.ToString();
return (tmp != null);
}
Now, my problem here is that even though I inputted the correct username and password after reloading the page it will still asked for the user name and password(sends me to the login page). I already set a value for the "isLog" cookie but still it return a wrong info.
View 1 Replies
Oct 26, 2010
I have a textbox where the enduser will type either a customer number (int) or a lastname, firstname and press a submit button. I need to programatically determine whether the text field of the textbox can be parsed as an int - and if so, process methodThis or if it is a string, process methodThat.
[Code]....
View 3 Replies
Dec 2, 2010
I have wizards in my app and when the user clicks one, the first thing I check is the "progress status" of the wizard for that user in case he/she has already started the process but never completed it. However, there's always a possibility that he/she might have completed 2 steps in a 5 step wizard.
I read the progress data into a simple List<WizardProgress> which looks like this:
StepID - CompletionDate
1 -- 12/1/2010 18:52:00
2 -- 12/2/2010 18:53:00
3 -- NULL
4 -- NULL
5 -- NULL
What is the best way for me to find the last completed step? It's easy enough to do a foreach but was wondering if there was a better way to do it.
View 1 Replies
Jul 16, 2010
can I retrieve the name that caused a postback? (VB.NET)
View 5 Replies
Sep 9, 2010
I came upon an interesting discussion with my team around the use of HttpRequest.UrlReferrer and wanted to solicit feedback from the community. According to the W3C spec:
The Referer[sic] request-header field allows the client to specify, for the server's benefit, the address (URI) of the resource from which the Request-URI was obtained (the"referrer", although the header field is misspelled.) The Referer request-header allows a server to generate lists of back-links to resources for interest, logging, optimized caching, etc. It also allows obsolete or mistyped links to be traced for maintenance. The Referer field MUST NOT be sent if the Request-URI was obtained from a source that does not have its own URI, such as input from the user keyboard.as input from the user keyboard.
The Request.UrlReferrer object does the work of converting referral strings that contain well formed URIs to an object with properties on every request. According to our logs there are requests that come in that contain invalid data in the referral such as:
localhost
app:/BeamBackTest.swf
app:/multtiple.swf
app:/AFriendFeed.swf
ALToolBar
app:/index.html
mhtml:file://C:Documents+and+SettingsUserDesktoporacleWhat+is+a+View+in+Oracle+-+Stack+Overflow.mht
Using Request.UrlReferrer would mean the above cases would be NULL. Is it better to discard the invalid data based on the W3C spec by using Request.UrlReferrer or preserve it by using Request.ServerVariables["HTTP_REFERER"] even though the data may be interesting, but potentially useless.
View 2 Replies
Jul 21, 2010
dear all. First and foremost the format of my dates are as follows (MM/DD/YYYY)
I have date 1 as 02/01/2007
I have date 2 as 02/07/2009
I would like to determine the number of days between those dates.
View 7 Replies
Aug 11, 2010
I need to test to if the div is toggled to hide. if it is not hidden I want to toggle it again ( slides left ). when they click the view report button on the Report Viewer control.
But I'm not sure how to find it's toggle values ( whether it's hidden )? ideas?
toggle click function
[Code]....
tried this and doesnt work
[Code]....
View 1 Replies
Aug 19, 2010
I am currently using Request.Useragent.Contains("string1") and if string1 matches with my useragent i am writing it on to the page, now I have to check with a collection ( array or list or ..) which contains {"string1","string2","string3"} and Response.write the useragent if the Request.useragent contains any of the strings collection (string 1,2,3). I am unable to detemine this and if i use a list or array, i am getting a "cannot convert from string[] to string" exception when i use it with Request.Useragent.Contains.
If there is a better way of achieving this, let me know. Its important.
View 2 Replies
Jun 1, 2010
I've got two radio buttons in a .net page which are being transformed to jQuery buttons a la [URL]
When the page is loaded I have button 2 as checked. When clicking the buttons I'm firing the postback event. Problem is you can click on that button that is selected by default on the initial load i.e. Button 2, the postback is fired but the event handler isn't called in the .net code behind because the radio button is already classed as selected (and in normal circumstances wouldn't allow the postback to fire).
To get around this I've added the e.PreventDefault() method BUT this is causing issues when Button 1 is clicked because before the click handler is called the button is set to selected. Therefore, in every case in the following code e.PreventDefault() is called:
[Code]....
What is the best way for me to load the page and effectively be able to do the following: 'If rbReceivable is checked then don't do anything otherwise do a postback.'
View 2 Replies
Sep 17, 2010
What I'm trying to do is use one master page with two different layouts. Currently we have a "master" master page that has all the common elements and two master pages that use it for the two different layouts. This gives us 3 master pages and there's developer confustion and it is a bit of a hassle to keep them consistent. What I'd like to do instead is say "if there's anything in the MainContent ContentPlaceHolder, show the single column layout, otherwise show the two column layout".
From what I've read you're supposed to be able to do this by using something like the following:
[Code]....
But this.MainContent.Controls.Count retuns zero when the ContentPlaceHolder uses Html.RenderPartial. For example, this works fine:
[Code]....
This causes this.MainContent.Controls.Count to return 1. If I remove MainContent from the view, it returns 0, as expected. However, if I do this:
[Code]....
Then this.MainContent.Controls.Count returns zero.
View 2 Replies
Oct 18, 2010
In Page_Load, Request["__EVENTTARGET"] is an empty string.IS there some way I can find out which button triggered the postback before hitting the buttons event handler
View 2 Replies
Dec 8, 2010
I am trying to create a web application that shows a list of events for different users. I have 2 different user 'roles': admin and member.
Is there a way of getting the current logged in users role? i have tried:
[Code]....
But it doesnt seem to be catching the certain user types, it always shows all of the events.
View 4 Replies
Oct 3, 2010
Can we Determine the availability of sufficient memory for an operation? if yes, then how can?
View 3 Replies
Aug 9, 2010
I know how to do this in a datatable but I would just like to learn how to do it in a dataview.
I have a dataview which is used to populate a gridview. It has the following column
userid Location
123 New York
124 Chicago
125 London
Now, I would like to know how to determine the 124 row and highlight it to a blue in a dataview used to populate a gridview. kindly note, i can do this in a datatable but not a dataview. I would like to learn how to do it in a dataview.
View 6 Replies
Nov 2, 2010
I have a databound grid with a templated field column that is a checkbox. When the user checks the checkbox, it will autopostback and update the row to indicate the box's check state.
My first attempt was to simply use the OnCheckedChanged method, but when this gets called, I have no way to know which row the checkbox came from. Thus, I don't know which row to update.
Can anyone suggest a method to determine which row the checkbox that fired the oncheckedchanged event came from? Or can you suggest a better way to achieve what I need to do?
I cannot bind the checkbox to the data column because I do not want the checkbox disabled in select mode, and do not wish to require the user to enter edit mode to change the value. I also need all rows to be editable. So, the best route seems to be in a templated column.
View 2 Replies
Dec 20, 2010
I am working on a project where we want to keep a history of a particular object. On save I want a method on the object that will determine if it has changed so that I can call a method to save its current state to history. E.g. I populate a form from an object the user makes changes (or possibly not) and submits the from. I want to take my original object and a copy of that object that has been updated from the form and determine if it has changed at all. Additionally I may decide at some point that certain properties don't matter (e.g. if Name changes I won't track it).
I'm thinking the easiest/most flexible way to accomplish this would be if I could give the properties I care about a custom attribute [ChangeTracked] and then I could use reflection to get a list of all properties with that attribute and loop through them comparing A.property == B.property to determine if any have changed.
Would this work? Is there a significantly better/easier way to handle this, like some sort of built in method you can add to an object to determine if the values of any properties have changed? Whatever the solution some psudo code would be appreciated. Just as a point of clarification the solution needs to determine if the value I care about has actually changed not just if it has been assigned since it was created i.e. if I set Name="bob" and it was already "bob" before my assignment this does not count as a change.
View 2 Replies
Apr 29, 2010
i want to export my excel data to sql server.
The excel data contain
1) id 1,2,3,4.5 which is int type
2) name abhi,soni which of varchar type
3) percentage 40.1,50.1,62.5 which is of type decimal
i wrote an application that will export data to existing sql server table
now what i want is to analyse excel data and then determine the type of data and then create a table with the analyse datatype and then export.
View 2 Replies
Apr 4, 2010
Using VB as code-behind in asp.net page...I have a TABLE control which I'm building dynamically. After the table is built, I'm trying to retrieve the HEIGHT property of that table to be able to dynamically position the next elements on the form. However, this control property is coming back as blank every time.
How can I get the height of the TABLE control AFTER building it, so I known where to place the next few elements in the flow??
View 2 Replies
Aug 25, 2010
i'm using a gridview and has a column of checkbox that is within a template field.
I want to do it in C# but I only found this code in VB
[Code]....
View 3 Replies
Aug 17, 2010
Currently, I'm just using clientside Javascript (location.href), but I am wondering if there is a way in Asp.Net to figure out the URL the user originally entered (assume I did not change it myself via 301), or at least to track it in a simple and reliable manner. As I am using my own implementation of URL rewriting via the global.asax (e.g. Context.RewritePath), this is not an easy task, particularly since I don't want to touch it too much.
Example
Global.asax:
public override void Init()
{
base.Init();
this.BeginRequest += new EventHandler(Global_BeginRequest);
}
void Global_BeginRequest(object sender, EventArgs e)
{
if (VARIOUSCONDITIONS) Context.RewritePath("SOMEURL");
}
SomePage.aspx.cs
protected void Page_Init(object sender, EventArgs e)
{
//Request.RawUrl is equal to "SOMEURL", as
//are other properties that store the URL.
}
View 1 Replies
Aug 12, 2010
I'm using ling2sql to display the record with the record ID that's in the querystring. I want to get the previous and next records in the table. What is the simplest way to do that? Is there a way to determine that the current record is the nth record in the table?
View 6 Replies
Mar 14, 2010
I am trying to figure out how to associate a specific user to a specific data on the site, like social networking site.
View 3 Replies