Asp.net Mvc 3 - Translating The Razor Syntax?
Jan 25, 2011MVC 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 RepliesMVC 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 RepliesTrying 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>
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.
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].....
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 RepliesI am working on MVC3, i have a situation where i want to do something like this:
<Div>
@Code
Dim i = 1
[Code]....
but razor is throwing wrong syntax error message. how to do this properly in side razor code.
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].....
I'm trying to write a simple/small Windows Communication Foundation service application in Visual Basic (but I am very novice in VB) and all the good examples I've found on the net are written in C#. So far I've gotten my WCF service application working but now I'm trying to add callback functionality and the program has gotten more complicated. In the C# example code I understand how everything works but I am having trouble translating into VB the portion of code that uses a delegate. Can someone please show the VB equivalent?
Here is the C# code sample I'm using for reference:
[code...]
Is that casting the callback object as type ICommunicationObject? How is that done in VB?
I have to admit, I can't always translate C# code to VB. Case in point:the MSDN library has the definition and example of an FTPWebRequest in C#, but not in VB. I think I can understand most of it, but can someone translate the small snippet below for me? Don't worry about the variable definitions, I've got that, but I can't tell of the subsequent methods are functions or sub routines.And what are those "get" and "set" calls?[code]......
View 6 RepliesHaving trouble converting a bit of C# code to VB.NET.I got his code from CodeProject:
[Code]...
I'm trying to translate some code from VB.Net to C#, but I've run into an issue.The Vb.Net line of code I want to translate is:[code]However, this is giving me a nasty 'Object reference is not set to an instance of an object' error.
View 3 RepliesI am more of a PHP Coder then VB.net Programmer so I made this and converting this function.
<?php
function grabshade($r,$g,$b){
$colors = array(array(0, 0, 0), array(255, 255, 255));
$differencearray = array();
[code]....
I'm not the best at reading and translating C#.
public IEnumerable ActiveEntities
{
get { return GetActiveEntities(Query); }
[Code].....
what I am trying to do it read a form of hex that is encoded I know the cypher what I want to do is make a program for myself that will let me compare 2 files. Both in hex decypher the hex to numerical.I call the hex backwards hex what I mean is this..in stead of "04 58 d2 d2" it is "d2 d2 58 04" I know the number it translates to is 72930002I want to show the entire list in a list box where I can choose wich I want to look at.
View 8 RepliesI am translating a piece of C# code into VB.NET using online convertors..[code]The VB.NET translation is not up to the mark and gives compiler errors Any VB.NET expert who can suggest what to change to make the code compile?url.
View 10 RepliesI recently asked a question about translating a code sample I found on on the internet from C# into VB and I was given links to websites that automate code translation [URL].. I am very new to VB and unfortunately the VB that the translators returned doesn't compile in Visual Studio 2010. I am hoping someone can help me fix the non-working portion of VB code.
Here is the C# code I am converting into VB:
[Code]...
In physics library written in C# I have the following code:
[Code]...
I'd like to do the same in VB. (just thandling the delegate, not the declaration) I tried this, but it doesn't work: AddHandler ContactManager.PostSolve, AddressOf PostSolve The following works, but only allows me to have one handler for the delegate: ContactManager.PostSolve = new PostSolveDelegate(AddressOf PostSolve) Is there a way for me to do the same thing in VB that was done in the first piece of code?
with translating some code from VB to C#.
Public Function ToBase36(ByVal IBase36 As Double) As String
Dim Base36() As String = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U",
[code].....
I am writing a program in visual studio to exchange data with a webservice. The webservice, Kareo.com, gives an example of a program but it is in C# - I am trying to replicate their program in visual basic, which is the language that I am more comfortable with. I got most of it to work but am running into problems with two lines "patientCase.Policies = new InsurancePolicyCreateReq[] { primaryPolicy, secondaryPolicy };" and "newPatient.Cases = new PatientCaseCreateReq[] { patientCase };"the C# version of the entire program is below.
[Code]...
Just a quick question, what will this code be in vb.net? if this is the wrong place for this request.
[Code]...
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.
I have this piece of VBNet code that i would like to translate into javascript:
Dim phone_check_pattern = "^(+?|((+?[0-9]{1,3}))|)([ 0-9.//-]|([ 0-9.//-]+))+((x|X|((e|E)(x|X)(t|T)))([ 0-9.//-]|([ 0-9.//-]+)))?$"
System.Diagnostics.Debug.WriteLine(System.Text.RegularExpressions.Regex.IsMatch("test input", phone_check_pattern))
my translated result:
var phone_check_pattern = "^(+?|((+?[0-9]{1,3}))|)([ 0-9.//-]|([ 0-9.//-]+))+((x|X|((e|E)(x|X)(t|T)))([ 0-9.//-]|([ 0-9.//-]+)))?$";
alert(new RegExp(phone_check_pattern).test("test input"))
However when i run it it has error Uncaught SyntaxError: Invalid regular expression:: Nothing to repeat
(my VbNet code doesn't have any error though)
i'm starting to learn vb.net, and i trying to make some special translating program, its need to translate hebrew text into special letter sequence. the text input are: ב יית בי יי ים מתקדמים (which its means Construction of advanced buildings ) And the text output are: BPJJZ_BJPJJPJM_NZWDNJM according to the list i made (Attached picture).
[Code]...
I want my code to look at a textbox to determine which letter is in it, & assign a numerical value to a second textbox, based on what letter is in the first textbox.[code]The problem is that, when I step through the code, I can see that Form20.txtGrade1.text DOES EQUAL "C", but my code skips over the part that says Form20.txtGrade1a.text = "4". Instead, if I hover over that part, I can read Form20.txtGrade1a.text = " ".When I do not step through the code, and just run it, I see the two textboxes, with the first one containing the C, and the second one is just blank.
View 4 RepliesIn my current project, i need to build a tool to translate text from some languages to English
Ex.: Chinese To English
Is there any translation SDK available?
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"})
I have almost completed a translation from C# to VB.NET, however, I run into some small errors[code]...
View 1 RepliesHow do I do this in Razor (VB.NET):
[Code]....
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 RepliesIs 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