Click here to Skip to main content
15,879,096 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can i transform this code to aspx?
HTML
@Html.ActionLink("Create New", "Create")
@using (Html.BeginForm("SearchIndex","Movies",FormMethod.Get)){
     Genre: @Html.DropDownList("movieGenre", "All")
       Title: @Html.TextBox("SearchString")
     <input type="submit" value="Filter" />
    }
Posted
Updated 8-Jan-13 2:33am
v2
Comments
Zoltán Zörgő 8-Jan-13 8:43am    
Why????
medloyl1 8-Jan-13 9:09am    
because i work with aspx forms
Zoltán Zörgő 8-Jan-13 9:56am    
In MVC4?... bad idea. But than why have you written that razor code? ;)

All you need to know what above code does, post which you should be able to do it.

Out here:
1. Create link is present
2. Followed by a dropdownlist, a textbox and a submit button
3. On click of this submit button, you need to search the movie name (written in the textbox) based on the dropdown category.

Try out now.
 
Share this answer
 
Comments
medloyl1 8-Jan-13 9:10am    
i just want to know how to convert this lines of code
can u help me plz?
Sandeep Mewara 8-Jan-13 9:14am    
I told you exactly that. Please don't expect exact code. Make some effort. Learn. Try.
Philippe Mori 5-Oct-15 12:42pm    
If you are using MVC, then you essentially only have to adjust markers used to delimitate text that need to be processed. Razor being somewhat smarter, you might sometime need more tags in ASPX for the same effect.

It should not be hard to do that...
medloyl1 8-Jan-13 9:21am    
i have an exapmle that i try to follow it
this example is in razor but me i wokr with aspx fomrs
all is working but i have an execption in the aspx code because it has a diffrence between C# ans cshtml..
i just want to convert this lines of code
that s only
Sandeep Mewara 8-Jan-13 9:24am    
Did you even read my answer provided? I gave you what needs to be done in plain and simple English. IIt does not matter you are working on Java or .NET or any other language. I gave the UI details and the feature provided by it as per your MVC view.

Now, since you work on ASPX, just do step 1-3 as mentioned above.
An easy way convert from one to the other is to run the razor view for this code, view the html source and then copy/paste that html source into your new asp.net view. At that point you just have to convert the relevant html elements into their appropriate asp.net controls.
 
Share this answer
 
Looking at mvc examples is pointless if you're using webforms as there is rarely an easy one-to-one conversion. You haven't provided enough information on where the data comes from and the controls are bound to their data in different ways. Rather than "converting" you're really looking at re-writing. So there is no point looking at examples that you need to rewrite, just try and find webforms examples of what you're doing, there are loads of examples around simple forms.

XML
<asp:Hyperlink Navigateurl="yourcreatepage.aspx" Text="Create" runat="server"/>
<form method="post" runat="server">
    Genre: <asp:Dropdownlist ID="ddlGenre" runat="server"/>
    Title: <asp:Textbox ID="txtSearchString" runat="server"/>
    <asp:Button ID="btnSubmit" Text="Filter" runat="server"/>
</form>


That is just the UI though, what happens to the data or how the dropdown gets populated is up to you, you didn't provide enough info to reproduce. Like I said above though, just stay away from MVC examples.
 
Share this answer
 
Comments
Philippe Mori 5-Oct-15 12:36pm    
Maybe he wants to use ASPX with MVC...
F-ES Sitecore 6-Oct-15 4:01am    
I thought about that, but he explicitly said webforms.
VB
@Html.Grid(Model).Columns(Function(columns)

                              columns.Add(Function(o) o.CatID).Titled("Cat #").SetWidth(40)

                              columns.Add(Function(o) o.CatName).Titled("Category").SetWidth(100)

                              columns.Add(Function(o) o.ParentCatID).Titled("Parent Cat #").SetWidth(40)

                          End Function
).WithPaging(10).Sortable(True)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900