MVC :: HttpStatusCodeResult Results?
Nov 17, 2010
Is it possible to return json data or content when using the HttpStatusCodeResult?I see it is possible to return a result description, but the ability to return an error object would be fantastic!
View 5 Replies
Similar Messages:
Sep 26, 2010
I have noticed that ASP.NET MVC 3 introduces a HttpStatusCodeResult action result. How do we do the equivalent in ASP.NET MVC 2? I want to return a 410 code.
View 2 Replies
Jan 26, 2011
In VS2010, when I "find in files", I often get doubled results in my find window.
View 5 Replies
Feb 3, 2011
In my asp.net project I need to call another url with a parameter and display what the url returns in a label. What is the easiest way to do this?
View 2 Replies
Mar 23, 2011
I am working on an application that requires a lot of data sets being sent to the client when application starts. To avoid multiple trips to the server I want to combine all the data together and send it as one piece. I cannot build one single SQL statement, it's going to be many. Should I just put SQL results together like strings?
View 14 Replies
Dec 11, 2010
I have 2 tables with a many to many relationship directory and website, they are linked by the table dw, the dw table has extra filds that are relivant to the link it is not simply 2 forain keys. So in my entity diagram i can see all 3 tables.
What I want to do is select all websites that are not linked to a given directory.
Here is my best attempt so far but it does not return any records
[Code]....
View 1 Replies
Jan 6, 2011
I have a dropdown box - code follows:
<asp:DropDownList id="DropDownListcofc" runat="server" DataSourceID="AccessDataSource1" DataTextField="Certify" DataValueField="Certify" Height="16px">
</asp:DropDownList>
Using a hyperlink I am attempting to post the selection from the box to the URL on the page that follows - code follows:
;<a href='http://www.gejfa.net/billie/guidingprinciples.aspx?ID=<%= Request.QueryString("ID") %>&CofC=<%= Request.Form("Certify") %>
The value of the ID post to the URL but the dropdown box doesn't. URL follows: [URL]
View 6 Replies
Mar 11, 2011
I have the following sql command:
SqlCommand cmd = new SqlCommand("SELECT * FROM tbl WHERE ID = 'john' ", con);
How can i output the results of the following command in C# to my webpage?
View 2 Replies
Jul 15, 2010
I am trying to make an asp site where someone types in a search term, then google (or any search engine) is searched for that search term and the resulting urls are compiled into a database.
Is this possible? How would i access the search results?I have seen other websites that do something similar - for example on one site you type in your search term and your website, and it comes back with which page your site is for that search term - how does it access the search results?
View 4 Replies
Feb 14, 2011
Firstly, im a PHP developer trying to get my head around asp.net.
so i have created a basic MVC project.
I have a query without the fields known (ie. select * from products) how do I:
execute in Controller - my attempt:
public ActionResult getProducts()
{
using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["myDB"].ToString()))
{
string sql = "select * from products";
SqlCommand cmd = new SqlCommand(sql, cn);
cn.Open();
SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
}
return View();
}
how do i pass the results to a View and then loop through them like:
foreach ($data as $key => $val)
{
echo $key.' = '.$val.'<br>';
}
this is SOOOOO simple in PHP but seems to be very confusing in asp.net.
View 1 Replies
Apr 3, 2011
just like in google, when you search for something. the websites are displayed without clicking submit button.
View 2 Replies
Feb 18, 2010
I added an autocomplete extension to a textbox, set up the web service and everything else I needed to get back autocomplete data, traced through debugger to make sure I was getting back the results I needed - - but still no autocomplete results. I thought maybe it was because my textbox was within a formview, within a wizard control, within a master page that was preventing me from seeing the results, so I set up a standalone ajax webpage, put in a textbox, set my service method and service path properties, and let it rip. Still no results.
Finally, after tearing out clumps of hair, I browsed my website using Firefox instead of IE 8. And there it was - - the results I was expecting.
So what is it in IE that is preventing me from seeing the popup results? I disabled the pop-up blocker in IE and that didn't work. I added my website to the allowed website in the pop-up blocker settings and that didn't work either. My guess is it's something under Internet Options => Security => Custom Level but I don't know what (yes, I have Active Scripting enabled).
View 2 Replies
Mar 17, 2011
datacontextclass dc=new datacontextclass ();
var news= dc.GetNewsCompany(Int64.Parse ( _idCompany));
if (news.GetEnumerator().MoveNext())
{
foreach (var item in news)
{
drpListNews.Items.Add(item.Title);
}
}
return error:{"The query results cannot be enumerated more than once."}
how can check result != null in LINQ;
View 3 Replies
Nov 16, 2010
[Code]....
This results in the whole table when it should not. What am i doing wrong?
View 2 Replies
Feb 16, 2011
I have a list of about 20 products, each with up to 30 possible attributes. I'm trying to figure out the best way to use checkboxes (representing the 30 possible attributes) on a form to filter the products, so that only products with the matching attributes would be shown. I can use SQL Server 2005, but it seems like that might be overkill.
(Additional) Edit: Ok, given the data structure below, how would you query the database to return products that have ALL of the matching features? Say Product #1 has features 1, 2 and 3. Product # 2 has features 2, 3 and 4. A query for features 1 and 3 should return Product #1, but not Product #2.
Products table
productID int
productname nvarchar(50)
Features table
featureID int
featurename nvarchar(50)
FeatureMap table
featuremapID int
productID_fk int
featureID_fk int
View 3 Replies
Jan 14, 2011
I have 2 pages on my site and they are exact duplicates at least on the first part of the page with the exception of declaring an additional arraylist and a databable. Why are the results in my source code of the browser showing doubled up? These results are with the below code and the exit sub right where it is.scotking.comzlinkexchange.comscotking.comzlinkexchange.com
View 5 Replies
Jun 2, 2010
I found an application that interacts with one of googles APIs that sends requests to the API and returns results to the web page. The owner of this app has made it publicly available and even though it is hosted on his server, it acts directly with the api from anyones browser. The source code in page source is available but since I dont know javascript, it is meaningless to me.
I would like to create an app that calls this web app and have it send requests to the API, and have the results parsed to a database. Would this be possible?
I have very little ASP experience and since trying to work through accessing the API itself is complicated since it involves using oAuth protocol and I am having a hard time with this with not much sample code available.
If this is possible, how can I get access to the results from this web app?
View 2 Replies
Jan 25, 2011
In my database one user can have multiple order. i want to get all orders for a user and save it in a list.
this is what i'm doing now
Public Function GetUserOrders(ByVal userID As Integer) As DataSet
Dim sqlDA As New SqlDataAdapter
Dim ds As New DataSet
Dim myCommand As New Data.SqlClient.SqlCommand("sp_GetUserOrders", myConnection)
[Code]....
but i can't seem to figure out how to assign the results to a list.
Dim orderList As New ListItemCollection()
orderlist = GetUserOrders()
View 1 Replies
Jan 10, 2011
Client(s) give me separate JS files which will run a check of some sort on the user's system (Browser type, are cookies enabled?, etc.) and a list of acceptable values to be returned from this check.
I want to run through each JS file when a user visits the site and compare the results to the list of acceptable values, then alert the user if they pass these requirements or not.
I'm currently using RegisterClientScriptBlock() to add the JS to the client's page, so it's being run, but I'm having issues getting the result value from the JS back to ASP.NET in order to do the comparison.
I've tried using hidden fields that the JS will dump the value to and ASP.NET will read from, but I'm having difficulty generating the hidden fields on demand (since I have no idea how many Js files the client could have) and have them work in the ASP.NET code.
View 1 Replies
Feb 24, 2010
I have a search form on my site. I want to post the search term to my controller. I just have a question about [AcceptVerbs(HttpVerbs.Post)]. It seems to post the field name. Why can't I just get the value ?View:
[Code]....
Controller:
[Code]....
Result:
ViewData["SearchTerm"] contains the value : txtSearch=my search term
View 3 Replies
May 26, 2010
I want a labet to be visible if there is no records found when search the database.
here is the code and the code behind:
<asp:TextBox
ID="TextBox1"
runat="server"></asp:TextBox><asp:Button
ID="btnSokDB"
runat="server"
Text="Sk"
Height="22px"
OnClick="btnSokDB_Click"
/>
<asp:Label
ID="lblTilbakemeldingSok"
runat="server"
Text="Sket gav null treff. Prv igjen!"
Visible="False"></asp:Label>
[Code]....
View 6 Replies
Feb 23, 2011
I'm populating a DataSet from an Sql query. I fetch some extra columns in my query as i need them to for further queries. I delete those columns after im' done with them, but i get a Column "columnname" doesn't exist in "dataset" error when i try to bind the DataSet to a GridView.
what could be the cause?
Edit: here's the code
The actual error message: "Column 'BID' does not belong to table results."
[code].....
View 3 Replies
Sep 9, 2010
For example I want to get the price of a particular item from table items. I created the connection string and the cmd for the search and put the result in an sqldatareader. How do I put the result in a string so I can use it later? Code so far of what I've done: (Code is in Vb.net)
Dim
conn =
conn As SqlConnectionNew SqlConnection("Data
Source=ComputerSQLEXPRESS;Initial Catalog=database;User ID=id; password=password")
Dim cmdSelect
As
New SqlCommand("SELECT Price FROM Items WHERE Code = Item1, conn)
conn.Open()
dtrReader = cmdSelect.ExecuteReader
While dtrReader.Read
lblPrice.Text = dtrReader.GetDouble(0).ToString
End
While
dtrReader.Close()
conn.Close()
Instead of the price the table is left empty.
View 3 Replies
Dec 1, 2010
The SQL is below - each result is coming up 3 times rather than just once.
SELECT Consignments.LegacyID, TripDate, CollectionName, DeliveryName, Pallets, Weight, BaseRate, Consignments.FuelSurcharge, AdditionalCharges, BaseRate * Quantity AS 'InvoiceValue', Consignments.Customer, InvoiceNumber,
CASE
WHEN child.LegacyID = Consignments.Customer THEN child.LegacyID
WHEN parent.LegacyID = Consignments.Customer THEN parent.LegacyID
ELSE this.LegacyID
END AS 'InvoiceAcc'
FROM SageAccount this
LEFT JOIN SageAccount parent on parent.LegacyID = this.InvoiceAccount
LEFT JOIN SageAccount child on this.LegacyID = child.InvoiceAccount
JOIN Consignments on (Consignments.Customer = this.LegacyID AND this.Customer = 'True')
OR (Consignments.Customer = parent.LegacyID AND parent.Customer = 'True')
OR (Consignments.Customer = child.LegacyID AND child.Customer = 'True')
WHERE (this.LegacyID = @Customer) AND (TripDate BETWEEN @fromdate AND @todate) AND (InvoiceNumber IS NOT NULL)
The SQL was given to me for another similar query, but this time I have modified it to try to use it for the query I'm doing now, so I'm assuming that I'm doing something stupid.
View 2 Replies
Mar 5, 2011
I have a query using LINQ-to-SQL. It queries an underlying database table Rooms. It uses Where conditions to narrow down the results, namely:
Gender.
Current Occupancy < Max Occupancy
Available Flag is Checked
I know this should return results but it keeps returning an empty set. Any ideas? Code is below
Dim selectedHalls = (From sh In dbHalls.Rooms _
Where sh.gender = Session("gender").ToString _
Where sh.max_occupancy > sh.current_occupancy _
Where sh.is_available = 1 _
Select sh.building_name).Distinct()
UPDATE: I've verified that the issue is with the statement where sh.is_available = 1, which doesn't make sense since this is a bit field.
View 3 Replies