Asp.net - Html.CheckBoxFor In VB Razor View?

Feb 27, 2011

I have this C# code in a Razor view:

@(Html.CheckBoxFor<RazorSamplesWeb.Models.SamplesModel>(i => i.IsActive))

I tried translating it to this:

@Code Html.CheckBoxFor(Of RazorSamplesWeb.Models.SamplesModel)(Function(i) i.IsActive)End Code

But it's complaining.

View 3 Replies


ADVERTISEMENT

HtmlAttributes On ASP.NET MVC 3 With Razor View?

Apr 7, 2011

how do I add this htmlAttribute on MVC 3 Razor view?

New With {.watermark = "sometext", .title = "sometext"}

I tried the C# way but it's not working (@watermark) but it's not working.

UPDATE here is the current usage I am trying but it's not working.

@Html.EditorFor(Function(model) model.FirstName, New With {.maxlength = "50"})

This isn't working either

@Html.EditorFor(Function(model) model.FirstName, New Object() {"maxlength=50"})

View 3 Replies

Access My.Resources From A Razor View?

Jul 6, 2011

I have a razor.vbhtml view and would like to use string resources normally accessible via My.Resources. Seems like I can only get to My.Computer, My.Log and couple other namespaces from the view, but not My.Resources. I've tried changing access modifier to public and adding Imports, neither worked.

View 1 Replies

Asp.net Mvc - Razor View Engine Quirks ?

Nov 12, 2010

I just downloaded the MVC 3.0 RC and I'm excited to start using it, especially the Razor view engine. However, due to a few stick in the mud type people here, we are stuck using VB.NET instead of C#.When I started trying it out, I noticed some quirks. If you are creating a Razor view using CSHTML, you can write code like this:

@foreach(string genreName in Model.Genres)
{
<li>@genreName</li>
}

Razor will automatically detect that the <li> text is an HTML tag and will switch out of "code mode". With a VB.NET VBHTML file, this doesn't seem to be working. It's making me put the @: keyword in front of each line like this:

@For Each genreName As String In Model.Genres
@:<li>@genreName</li>
Next

If I don't have it there, I get a runtime error. Also, the <text></text> tags don't seem to work.

View 3 Replies

Converting C# Razor View Syntax?

Mar 21, 2012

I am new to Razor view syntax and as most of the examples are in C# in coverting the below Razor syntax to vb.net

<div>
@using (Html.BeginForm())
{

[code].....

View 1 Replies

Namespace Reference In .NET MVC3 Razor View In VB?

Jan 25, 2011

How do I reference a Namespace in .NET MVC3 with the Razor view engine?

I understand this can be done in C#:

@using Namespace;

However in VB this doesn't seem to work:

@Imports Namespace

(i'm talking about inside a .vbhtml file)

View 1 Replies

Asp.net Mvc Including File Upload In Razor Form View

Dec 9, 2011

MVC 3, VB.NET. I have a form in my app that gets basic information from the user and then allows them to upload a resume. I am accomplishing this right now by using a redirect to a different form that's only purpose is to select the file for uploading and then submit it.. Sloppy in my opinion.. I have tried to do it from the same form but the file is being lost on submit.. While I am not certain of it I believe it is because I am not using the correct syntax in the form to handle the file.[code]

View 1 Replies

Html - Returning A File In A New Browser Window Using Mvc 3 Razor?

Oct 12, 2011

I have a funtion that returns a generated PDF file but the problem is it shows it in the current browser window... I need for it to open in a new window. I dont see how I can pass it into a view for displaying where I could simply use target: _blank.

Function showUserPDF(ByVal pdfName As String) As ActionResult
Dim _fileName As String = pdfName
Dim _path As String = Path.Combine(AppDomain.CurrentDomain.BaseDirectory) +

[Code].....

View 1 Replies

Unable To Use Microsoft.Web.Helpers In Razor View Vbhtml File

Oct 18, 2011

I want to use the Linkshare helper in the Microsoft.Web.Helpers dll. I added the reference to my project but if attempt to use it in the vbhtml file Visual studio underlines it with a blue squiggly and tells me it is inaccessible blah blah. I even added references to those webmatrix dlls as described here[url]...

View 2 Replies

Mvc 3 - MVC3 Razor View Project Gives Syntax Error In Error List Window For All VBhtml Pages?

Feb 22, 2011

Using MVC3 and Razor View engine, I created a VB.NET web application in VS 2010. This creates the default Account and Home Controller along with corresponding Action Views.Now if I open any vbhtml file I get the following error message in the Error List window.

Error 50 Syntax error. C:****MVC3AppVBViewsAccountLogOn.vbhtml MVC3AppVB
(See screenshot here http://www.flickr.com/photos/7672540@N07/5469248676/)

[code].....

View 2 Replies

Convert A Html String Or The Below Sting Into A Tree View Or A List View

Jun 9, 2009

the VB .net experts. I added the following code and I get an error as shown below.

[CODE]....

View 8 Replies

Error When Using CheckBoxFor In MVC With VB

Apr 18, 2012

I'm trying to create a checkbox with the following code:

@Html.CheckBoxFor(Function(model) model.PotentialDishmachineProducts)
@Html.ValidationMessageFor(Function(model) model.PotentialDishmachineProducts)

But, it keeps throwing up the error:

"Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions."

Here's the property in the model:

Public Property PotentialDishmachineProducts As String

It is not tied into a database or anything. how to get this checkbox to work? Btw, if it's not obvious, I am brand new to MVC and VB.

View 1 Replies

View Html From Textbox?

May 14, 2009

How would you be able to view html of any page or created page from a textbox?[code]...

View 2 Replies

How To Convert BB Code To HTML View

Dec 11, 2009

The point of my idea is to write a program for a Web site that has it's own BB CODE (PHP) ,then user of the program can write his message and range his message with this BB code (inside the program) , all this can be done easily , but just one thing I can't do , How can I add a Review before send with this BB code (without connect to internet) , I mean convert this bb code to a HTML page has the same appearence of the eal message .

View 1 Replies

View HTML Page In Form?

May 20, 2010

i have a button that grabs a text file depending on what the user types in a text box.And then it loads the text file and makes an HTML report on an external browser. Thats all good.But i want another button under that button that does exatly the same thing but it displays the html in a form using Web Browser for vb.net. 2008 version by the way. so i have two buttons, depending on what the user pushes. same html is produced, but one is in external browser while the other is in form.Here is code i used for first button

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sFilename As String
sFilename = ("E:\RMIT WORK\Testing\" & txtOfficeID.Text & ".txt")
If Not File.Exists(sFilename) Then

[code]....

View 6 Replies

View The HTML Page Source Of Website?

Dec 13, 2009

Like in firefox or Internet Explorer where you can right click and view the html page source how can you do this in an app?I have a web browser in the form and I'm trying to view the web page in the web browser and then view the source code of that page in a box below it.

View 8 Replies

VS 2005 - View HTML Source Code For Current Web Pages?

Jun 6, 2009

I want to use one button and one textbox to view the HTML Source Code for current Web Pages,or use vbscript(but not use the method of xmlhttp)

View 6 Replies

VS 2010 When Opened Save Html Page / Not Able To View Image

Oct 19, 2011

I m using this code for downloading a webpage [code]but when i opened the save html page.. I was not able to view the image's.

View 8 Replies

Disable The Right Click Event In The WebBrowser Control While It Is In Folder View Mode (and Not HTML)?

Jun 7, 2012

Tried to look for a solution for this problem everywhere and can't seem to find it?I have found solutions related to sub-classing the document, but this method results in a Null Exception as there is no document.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

AddHandler Me.WebBrowser1.Document.ContextMenuShowing, AddressOf WebContextMenuShowing
WebBrowser1.ContextMenu.Dispose()
WebBrowser1.ContextMenu.Show(WebBrowser1, pas)
End Sub

[Code]...

View 3 Replies

Asp.net - Converting C# Razor To VB?

Feb 28, 2011

I'm following the ASP.NET MVC Tutorial and having started in VB.NET I'm having trouble converting the following razor code:

[code]...

on both the <li> tags. I understand I need to use line continuation but can't figure out where. I'd be greatful if you can point out the problem.

View 3 Replies

Html Source Code Doesn't Show Html But In Firebug Inspect Element Html Is There?

Jan 10, 2012

This may sound really stupid but I have to ask cause I'm not finding this answer anywhere.I have an application where the user will need to sign up for a new user account on the website [URL]..However when I am using Firefox's plug-in Firebug to view html I am getting something totally different than when I just right click on the site and view the page source.

What I am trying to do is to get the captcha from the website and display it in a picturebox on the application so the user can view the captcha, solve the captcha and then the app post is back to the service for a response.

Here is the source that I am getting using Firefox's Firebug to inspect the element:

<td>
<input type="hidden" value="Oo3Jo1I8bgzK68agMqo3s79ZZib2OkbK" name="iden">
<img class="capimage" src="/captcha/Oo3Jo1I8bgzK68agMqo3s79ZZib2OkbK.png" alt="i wonder if these things even work">
</td>

[Code]...

Why would the two be showing me two different versions of the HTML?

And how would you be able to grab that source to view in a picturebox using webclient?

View 2 Replies

Asp.net Mvc 3 - Translating The Razor Syntax?

Jan 25, 2011

MVC 3 is great but in some cases I am having trouble translating the Razor syntax. Anyone know of a good VB.Net Razor reference?

View 1 Replies

Asp.net Mvc Razor For Loop Syntax

Apr 5, 2012

Trying to create VB.net equivalent for following code and I get error

<ul>
@for (int i=0; i < ViewBag.NumTimes; i++) {
<li>@ViewBag.Message</li>
}
</ul>

View 2 Replies

What Is The .NET Equivalent Of This C# Razor Syntax

Nov 29, 2011

In the MVC 3 book by Steven Sanderson on p185 at the bottom, the following expression is used to render the paging links.

@Html.PageLinks(Model.Paginginfo, x=> Url.Action("List", new {page = x}))

What is the VB.NET equivalent? I am stuck on the x url lambda bit.

View 1 Replies

Sending An HTML Email, Where The HTML Comes From An HTML File .Net/ClickOnce Environment?

Jun 20, 2009

Usage: Users create pretty HTML news letters in another app. They post the newsletter to the web, but they also want to set the contents of the HTML news letter file as the body of an email and send it using Application In Question. The users understand to use absolute link and image references when sending an E Newsletter. Environment:

AIQ is a VB.Net app deployed via ClickOnce. It is an intranet app; one can be sure MS Office 2003 and the interop 11 dlls are on the target machines.

Restrictions: MAPI is out. It mangles the HTML. Since it is a ClickOnce deployment, we can't register dlls (I think, correct me if I am wrong). Therefore CDO and COM is out (again, I may be wrong.... I would be happy to be proven so).

View 1 Replies

.net - Concatenate Tag Attribute Value Using Razor And A Prefix

Jun 16, 2011

How do I do this in Razor (VB.NET):

[Code]....

View 1 Replies

Asp.net - @Model Not Supported In Razor Views For VB?

Feb 27, 2011

Is not the @Model MyModelClass notation not supported in VB Razor Views? It's not working for me. What is the construct for it?

View 1 Replies

Mvc - MVC3 Razor SelectedValue In DropdownListFor?

May 30, 2012

I've the following code for a DropDownListFor and is working ok

@Html.DropDownListFor(Function(model) model.Habilitacoes, New SelectList(ViewBag.Habilitacoes, "KeyHL", "DescricaoHL"), New With {.class = "FillHSpace"})

[code].....

View 2 Replies

VB - ASP MVC 3 Razor Extra Whitespace Rendered

Jul 8, 2011

I am getting extra whitespace characters rendered in my horizontal list of anchor tags below. This is causing a major CSS styling issue for me. I know this question has been addressed as far as a C# workaround is concerned (asp.net mvc razor extra space), but can anyone help me with a VB workaround? I don't have the advantage of curly braces to eliminate all whitespace in a single-line If condition.

I have managed to work around it for now by writing an HtmlHelper extension method, but this dynamic code is only used in one place (the master layout page). It seems to me that this should really be done in the .vbhtml page. Here is the erroneous code, along with commented-out attempts at workarounds. The goal is to create a horizontal list of "sibling" pages based on a site map, with slightly different styles for the current page's link and the link just before it. [Code]

View 1 Replies

What's Razor Syntax To Create A Table

Mar 15, 2012

This should not be as hard as it seems to be, but I can't for the life of me create a table in VB using Razor syntax. The following does not work (despite what some examples would lead me to believe):[code]

View 2 Replies







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