MVC :: Url Routing After Results From A Dropdown List?

Jun 23, 2010

I'm getting a query results from a drop down list and the url after the query look like this

"
http://localhost:52840/Home/Restaurants?City=newYork
"

When" restaurants" is the page name

I would like to get the results without the query string parameters

To look like this (for example )

/restaurant (and the selected city parameters )newyork


The query that I'm passing in my dropdown list look like this :

[Code]....

View 7 Replies


Similar Messages:

ADO.NET :: Object Oriented Linq - Populate Second Dropdown List With Results?

Sep 23, 2010

I am wondering into the unknown field of OOA and was looking for a way to separate my business logic from my UI. A small example is as followed:

Two DropDowns where the second one is depended on the selection in the first DropDown. You have Cars, planes, etc. inm the first DropDown and Toyota, Chrysler, etc in the second (depending on the value in the first DD.I have som Lin syntax. The file is situated in the App_Code folder and NOT as code behind. [Code]....

I would like to know how i can make populate my second Dropdown list with results. At this point it's just putting in the complete ProductSubCategory.

View 2 Replies

Forms Data Controls :: 2 Dropdown List / "Displaying A Dropdown List Of Categories With A --None -- Option?

Oct 10, 2010

I am stuck at this point "Displaying a dropdown list of Categories with a --None -- Option. I want the gridview control to display 2 dropdown list one in read-only mode and the other in edit mode. When a record is in read-only mode, the dropdownlist's enabled property will be set to false."When it's on a read-only mode, it doesn't display the selected Category. it shows but the "No Category". When i click on edit to edit or change category, it doesn't display the selected category.

The example is given below( I am reading the book Sams Teach yourself ASP.NET 2.0 by Scott Mitchell. page 628)

<asp:Label ID="UserIdValue" runat="server" Visible="False"></asp:Label>
<asp:SqlDataSource ID="picturesDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [Pictures] WHERE ([UserId] = @UserId) ORDER BY [UploadedOn] DESC"
DeleteCommand="DELETE FROM [Pictures] WHERE [PictureID] = @PictureID"
InsertCommand="INSERT INTO [Pictures] ([UserId], [CategoryID], [Title], [Description], [UploadedOn]) VALUES (@UserId, @CategoryID, @Title, @Description, @UploadedOn)"
UpdateCommand="UPDATE [Pictures] SET [UserId] = @UserId, [CategoryID] = @CategoryID, [Title] = @Title, [Description] = @Description, [UploadedOn] = @UploadedOn WHERE [PictureID] = @PictureID">
<DeleteParameters>
<asp:Parameter Name="PictureID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="UserId" />
<asp:Parameter Name="CategoryID" Type="Int32" />
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="UploadedOn" Type="DateTime" />
</InsertParameters>
<SelectParameters>
<asp:ControlParameter ControlID="UserIdValue" Name="UserId" PropertyName="Text"/>
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="UserId"/>
<asp:Parameter Name="CategoryID" Type="Int32" />
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="UploadedOn" Type="DateTime" />
<asp:Parameter Name="PictureID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
<br />
<asp:SqlDataSource ID="categoriesDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [CategoryID], [Name] FROM [Categories] WHERE ([UserId] = @UserId)">
<SelectParameters>
<asp:ControlParameter ControlID="UserIdValue" Name="UserId" PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<asp:SqlDataSource ID="maxPictureIDDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT MAX(PictureID)
FROM Pictures
WHERE UserId = @UserId">
<SelectParameters>
<asp:ControlParameter ControlID="UserIdValue" Name="UserId"
PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<asp:Label ID="cannotUploadImageMessage" runat="server"
Text="The photo could not be added to your album either because you did not specify a file to upload or the file specified was not a JPEG image with the file extension .JPG"></asp:Label>
<br />
<asp:DetailsView ID="dvPictureInsert" runat="server"
DataSourceID="PicturesDataSource" Height="50px" Width="125px"
AutoGenerateRows="False" CellPadding="4" DataKeyNames="PictureID"
DefaultMode="Insert" ForeColor="#333333" GridLines="None">
<AlternatingRowStyle BackColor="White" />
<CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
<EditRowStyle BackColor="#2461BF" />
<FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
<Fields>
<asp:TemplateField HeaderText="Picture">
<InsertItemTemplate>
<asp:FileUpload ID="imageUpload" runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="imageUpload" Display="Dynamic"
ErrorMessage="There was no file selected" ValidationGroup="PictureAdd"></asp:RequiredFieldValidator>
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Category" SortExpression="CategoryID">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("CategoryID") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:DropDownList ID="pictureCategory" DataSourceID="categoriesDataSource"
runat="server" DataTextField="Name" DataValueField="CategoryID"
SelectedValue='<%# Bind("CategoryID") %>'
Visible='<%# Bind("CategoryID") %>' AppendDataBoundItems="True">
<asp:ListItem Selected="True" Value="">-- Select Category --</asp:ListItem>
</asp:DropDownList>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("CategoryID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Title" SortExpression="Title">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Title") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Title") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox1" Display="Dynamic"
ErrorMessage="you must provide a name for the title"
ValidationGroup="PictureAdd"></asp:RequiredFieldValidator>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("Title") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Description" SortExpression="Description">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Description") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Description") %>'

View 2 Replies

Can Populate Second Dropdown With Results From Table Selected In First Dropdown

Dec 9, 2010

I have a dozen tables, and two dropdown lists.The first drop down list shows the table names. The second dropdown list needs to be poulated with the data from the specific table selected in the first dropdown list.I wrote a stored procedure that will query the selected table name choosen in the the first dropdown list. My results though are only showing this...

[Code]....

View 7 Replies

Web Forms :: Dropdown List To Dropdown List GUID?

Nov 3, 2010

I have 2 drop down lists.I have a very simple dropdown list #1 that diplays a title and holds an id value which is a GUID.I know it is getting this value and sending this value as I tested sending it to a label.I have the dropdown list #1 to autopostback to dropdown list #2 that "Is supposed to get" another title and value based on the GUID value of the first dropdown list. for some reason it wont return anything. I have done 100's of these but never based off a guid value.I assume the value needs to be converted to guid before selecting it in the second dropdown list.How can I do this? or is there something I am missing?

View 9 Replies

Web Forms :: When Selecting An Item From One Dropdown List It Populates The 2nd Dropdown On Aspx Page?

Sep 8, 2010

Does anyone know how to do this so when I select something the 1st dropdown and the 2nd one becomes visible and populates list from a Select statement. I really need help on how to do in an aspx and not on the code behind page.

View 12 Replies

Web Forms :: DropDown List Not Retaining The Values(the DropDown Inside Gridview Control)?

Jun 12, 2010

I Have the gridview control with 2 dropdown list and 2 text boxes,When the textbox chnaged event happen 1 row will create and the dropdown back to initial values( its not retaining the selected values),I am binding the control after text changed method,Is there any properties needs to be set or any other way we can retain the values in postbacks?

View 4 Replies

JQGrid Inline Editing - Filter Subcategory Dropdown List Based On Another Category Dropdown

Jul 9, 2010

I have a category and a subcategory column in a Jqgrid. I have enabled inline editing, both category and subcategory are dropdownlists columns (edittype:'select'). I need to filter the subcategory list based on the selected category. I wonder how can I acheive this functionlity? I tried the below event but its not working for me

afterEditCell: function(rowid, celname, value, iRow, iCol) {
//to do here
}

the above event doesn't get fired. my all column are editable

View 1 Replies

Web Forms :: Sorting Dropdown Results In Code Behind?

Jan 11, 2011

I'm trying to figure out how to grab results from AD (works fine) and then take those results and sort them alphabetically.

[Code]....

View 2 Replies

AJAX :: Display Cascading Dropdown List Based On Checkbox List Selected Value

Nov 10, 2010

How can i generate dropdown lists based on what has been selected in the checckbox list. Below is an example of what i need. if the user selects the options day, lotID and waferID, then 3 cascading dropdown lists should be displayed. And then a gridview displays data based on what has been chosen in the dropdown lists.

Day
LotID
SlotID
WaferID
VendorID
ToolID
LocationDetected
ProcessStep
Stage
Precipe
WaferStartMaterial
WaferStartVendor
WaferStartLot
WaferDiameterCOA
WaferMapTitle
BreakPoint
BreakpointSide
BreakpointMeasurement

View 3 Replies

Web Forms :: Clicking The Label Of A Dropdown List - Resets The Selected Value To The First Item In The List?

Feb 17, 2010

Clicking the label of a drop down list, re-sets the selected value to the first item in the list. This has a history of causing data entry problems when users accidently click on the label.

In the below example ddlContactType has a selected value as 'PRIMARY' and whenever i click on the lblContactType Text, the dropdown box Selected value is changing to "Select One" Text.

How to prevent this one. It should be on PRIMARY Only.

<p>
<tr> <td ><asp:Label ID="lblContactType" Font-Bold="true" Text="Contract Type: *" ForeColor= "red" runat="server" AssociatedControlID="ddlContactType"></asp:Label> </td> <td > <asp:DropDownList runat="server" ID="ddlContactType" DataSourceID="SqlDataSource2" AppendDataBoundItems="true"
DataTextField="TYPE" DataValueField="ID" SelectedValue='<%# Bind("CONTACT_TYPE_ID") %>'>
<asp:ListItem Text="Select One" Value="0" Selected="True"></asp:ListItem>.......

View 4 Replies

Forms Data Controls :: Databound Dropdown List / Shows First Value In List Rather Than Current Value?

Jan 17, 2011

I have a databound dropdownlist and have a problem with the default value it selects.When I attempt to edit a record the dropdownlist shows the first value in the list rather than the current value. I want the dropdown list to display the current value.

I'm sure this is very simple but I'm very new to ASP.NET.

I'm using .NET version 4.

View 4 Replies

Web Forms :: Results Based On Dropdown Selection Of Month And Year

Jan 13, 2014

I am trying to display results based on both dropdown list selection.If a user selects Jan from 1st ddl and 2013 from 2ns ddl then results of Jan 2013 will be displayed to the user,everything works fine,I wanted to confirm the query that I have used is correct or not.

Store Procedure

Create proc usp_monthwisedata
@month int,
@year int

[Code].....

My concerns are:

1.Is the way of writing the Sp is correct to achieve the result.

2.Is it correct to set the onselectedindexchanged of both the ddls to 1 method i.e onselectedindexchanged="DropDownList1_SelectedIndexChanged" 

3.Over all Performance wise is it correct.

View 1 Replies

Populating A Dropdown List Based On Value Selected In Previous List (mvc3)

Mar 18, 2011

I'm trying to progam a strongly typed "Create" view using MVC 3 and razor. I want the user to be able to select a customer from a dropdown list (I populated this from my database using ViewBag in the controller). When the user has selected a customer I want a separate dropdown list to generate a list of dogs belonging to that customer related by the customerID in the database. The create button on the form will then take both of these values along with the the other fields and save it to the database.

View 1 Replies

AJAX :: Autopostback On The Last List In A Cascading Dropdown List Series/ Invalid Postback Or Callback Argument

Aug 20, 2010

I have a Cascading drop down list that is working fine to load the correct lists however I would like to have the last one initiate a query and display a datagrid on the same page containing the results of the query. Without Ajax involved this seems rather easy by using autopostback on the drop downs. If I could do it through Ajax that would be great but I can settle with having the page to reload to display the data. Right now I'm not sure how to do either. I enabled autopostback on the last drop down and wrote a method for it but I get an error at runtime saying:

Invalid postback or callback argument

View 4 Replies

Templates - Populate List Items In Dropdown List From Placeholder?

Feb 24, 2010

I'm designing my own custom control that contains a .NET dropdownlist. What I'm wondering is if it is possible to populate my dropdownlist with listitems placed in a placeholder? For example:

<asp:DropDownList ID="ddlFilter" runat="server" >
<asp:PlaceHolder ID="ListItemPlaceholder" runat="server"/>
</asp:DropDownList>

This doesn't work because the DropDownList control only allows ListItems as child controls. But, I want to do something similar to this so when the user includes my control on a page, they can do something like this:

<mytag:MyControl Mode="DropDown" runat="server">
<ListItemTemplate>
<asp:ListItem Text="C" Value="c"></asp:ListItem>
<asp:ListItem Text="E" Value="e"></asp:ListItem>
<asp:ListItem Text="B" Value="b"></asp:ListItem>
</ListItemTemplate>
</myTag:MyControl>

I know I can do this by dynamically adding the ListItems in the page code behind, but I'd like to avoid that if possible.

View 1 Replies

Web Forms :: Disable Dropdown List When One Of Radiobutton List Is Checked

Jan 2, 2013

How to disable two drop downs on checking one of radio button from radiobutton list,,its like radiobuttons with no ID in side <asp:RadiobuttonList> tag. 

View 1 Replies

Web Forms :: Populate Dropdown List From List Of Table

Feb 8, 2011

I'm trying to populate a dropdown list from a list of existing SQL tables in a database. Does anyone have a code sample for doing this?

View 10 Replies

.net - Saving SQL Results Into A List?

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

MVC :: Unable To Add Dropdown List Next To A List View?

May 27, 2010

I have a list on the page & I'm trying to add it a dropdown list to narrow down the results

(that I'm not sure is the best way to do so (any suggestion is welcome)

In my class the Query look like this:

[Code]....

In my controller my this is what I have tried :

[Code]....

( I think I have tried every thing that make sense for me )

and the view look like this :

[Code]....

& so on ...

[Code]....

View 5 Replies

Bound Countries List Using DropDown List In VB?

May 4, 2010

How to bound countries list using DropDown list in VB ASP.Net?

View 9 Replies

Display A List Of Results With Numbers?

Sep 14, 2010

I have a common problem in an ASP.NET web form. I'm just surprised that I haven't found a common solution :)

I have a list of results being returned from a SQL Server database. I want to show those results in my web page with number to the left of them. For instance, my result set may look like the following:

New York | NY
Chicago | IL
Los Angeles | CA

In my web page, I would like to show them as:

1. New York, NY
2. Chicago, IL
3. Los Angeles, CA

I was surprised that I can't find a way to make the numbers automatically appear. Am i doing something wrong? If not, what is the recommended approach?

View 6 Replies

Web Forms :: Web.Routing Doesn't Work On Server On IIS Routing

Jul 20, 2010

I tried everything I could find, but still does not work on IIS routing.

View 2 Replies

Dropdown List Selected Value?

Nov 23, 2010

In my application iam having two dropdownlist .i bind the the database to dropdownlist using c# with asp.net but i store the datavaluefeild(id).similar way i fallow for another ddl also. My Aim is while selected index change event of first ddl i have show the corresponding text of second ddl in front end....both the textbox i store the selected value in database

View 1 Replies

Dropdown List Not Changing Value

Feb 9, 2010

I have the following code running, my dropdownlist (cboroles) is not changing the current item being viewed. This code is running under ispostback = false in the page_load event

[Code]....

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved