this in <% using Html.Form<ProductController>(p=>p.Update(ViewData.Product.ProductID))%>

How do I do this in
<% using Html.Form<ProductController>(p=>p.Update(ViewData.Produc t.ProductID))%>

This is using a lambda for the form tag in c#, I searched everywhere for the correct syntax?

 I tried this with no luck:
<% Using Html.Form(Of ProductController)(Function(p) p = ViewData.Product.ProductID)%>


4/4/2008 7:33:09 PM 4300 articles. 0 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 9
Get it on Google Play
Get it on Apple App Store

VB.NET doesn't support Lambda expressions.   

View My Blog Download My URL Rewriter and Reverse Proxy

Only $9.95/month, ASP.NET, 2GB & SQL 2005
4/5/2008 4:27:59 AM

Function(p) p = ViewData.Product.ProductID

I think the proper syntax is Function(p) p.Update(ViewData.Product.ProductID).

Check for more info.  Honestly, though, if the syntax isn't familiar to you I'd recommend using one of the other overloads that doesn't use a lambda.  It'll save you time trying to decipher it when you have to go back and look at it in the future. :)

4/5/2008 5:01:53 AM

Thanks, I tried that syntax with no luck :(

 I will have to go back later and update this stuff, just trying to get it right from the get go. 

having the same problem with the ActionLink helper

4/5/2008 1:56:48 PM

Hello alivemedia!

 You're right the lack of lambda-support in VB.NET is really ackward. I use a syntax that works, but is far to long to be nicely readable, but it gives you the benefit of refactoring-support:


<%Using Html.Form(Of CustomerController)(New System.Action(Of CustomerController) _
(Function(c As CustomerController) c.Login()), FormMethod.Post)%> <%-- FORM CONTENT --%> <%End Using %>


As a workaround you need to declare the methods, which you want to use in your Html.Form() call (here it is Login() in my CustomerController class), as functions of type object (or something) else and just return Nothing in the respective Method. This worked for me. A sample Login() method would look as follows:


1    Public Class CustomerController
2        Inherits System.Web.Mvc.Controller
4      Public Function Login() As Object
6         RenderView("Login")
7         Return Nothing
9      End Function
11   End Class


 Hope I could help!



4/7/2008 8:38:52 PM

Similar Artilces:

How to strip a string of <html>, ,</html>, <body>, </body>, <form ... >, </form> tags?
I have stream which is the HTML input of a page. Now I want to use only that part of this page, that is within <form .....> and </form> tags, and excluding these tags.How would I go about stripping <html>, ,</html>, <body>, </body>, <form ... >, </form>, <head> and </head> tags? I have to make sure that <head ...javascript..> and its corresponding </head> tags are not stripped in this process.sun21170    Wait... you said you wanted to strip the head tags, and you're also saying you need to NOT strip the ...

Is <p><!-- pagebreak --></p> working with SM
If a receive an HTML mail from per exemple phpmailer.php ans this mail is in an HTML format.... Is this paragraph <p><!-- pagebreak --></p> acting as a skip to a new page, when i print the mail received by my SM email client ? Ray_Net wrote: > If a receive an HTML mail from per exemple phpmailer.php ans this mail > is in an HTML format.... > Is this paragraph <p><!-- pagebreak --></p> acting as a skip to a new > page, when i print the mail received by my SM email client ? Maybe the author was hoping it would, but there is no reason ...

<p><%# Server.HtmlEncode(Eval("Caption").ToString()) %></p>
what does that line of code do???    learning.. : ) It retrieves the string represention of the Caption field from the databinding context (maybe data from a database or an xml file), and encodes it as HTML (replacing "&" with "&amp;" etc.)  -- "Mark As Answer" if my reply helped you -- Also, use Eval's built-in string format, rather than calling ToString...<%# Server.HtmlEncode(Eval("Caption","{0}")) %>Much nicer for dates...<%# Eval("MyDate").ToShortDateString() %>&l...

Lists in .net
Like a good AKA accessible app building developer, my application's navbar is controlled with CSS and using <ul> and <li> I just have the code in the HTML display and it works fine when everything should be visible, however, I need to restrict some users from viewing certain navbar links based on their security levels.  How do I hide the list items that need to be hidden? TIA hello! give them ids and runat="server" attribute. then in code behind set the Visible property to false. orzeh code less, think more! Okay, I tried putting the link as a link bu...

Difference between \<p>[^x]*<li\ and \<p>[^a]*<li\ ?
What is the difference between \<p>[^x]*<li\ and \<p>[^a]*<li\ ? I was cleaning up a webpage, trying to find paragraph tags followed by list-item tags (some of which had a space inside the tag), with anything in between, and tried the first (forgetting off hand the RegExp char for "any character"). There was a string " <p> \n <ul ><li " which the second RegExp picked up, but the first one instead selected a range about 3000 chars long. Thanks, Jim Witte At 22:56 2002.02.15, Jim Witte wrote: > What is the diff...

w3c validator (xhtml 1.1) gives "document type does not allow element "<tag>" here; assuming missing "<list tag>" start-tag " error if the output includes "<p$Lame></p>" after a list element... I think that if the '/item-bullet' => "</li><p$Lame></p>\n", '/item-number' => "</li><p$Lame></p>\n", '/item-text' => "</a></dt><p$Lame></p>\n", 'Para_item' => "\n<dd>&...

How to remove <p> and <b> and <i> tags
Hi, I have some text in the database which has Html tags. I want that when I display the data the tags are removed.HighOnCodingWanna get high! You might consider called Server.HtmlEncode(data) on the rows to convert the html to characters that will be displayed in the browser.--Brian DesmondWindows Server MVP - Directory Services Hi, Thanks for the Quick reply. Well now its displaying something like this: " &lt;P&gt;&lt;P&gt; &lt;i&gt;&lt;P&gt;if( dr.Read())&lt;P&gt;&lt;P&gt;{&lt;P&am...

>>>> Heads up <<<<
I just got a warning from Norton that "PamelaSetup-Basic.exe" has a virus in it. The name is "VirusBurst" Luckily, I did not install this software and Norton's quarantined it so I could delte it, which I have done. Symantec has not completed analysis of this particular piece of garbage but it did catch the sig. If you have installed Pamela, you may be in trouble. Duffy wrote: > I just got a warning from Norton that "PamelaSetup-Basic.exe" has a virus > in it. The name is "VirusBurst" > > Luckily, I did not install...

edit module html <p> </p> gives error
Hi I have added a tab and in that tab I have added 2 html modules from existing modules, I then click the edit button and add new text but when I try to format the text with <p> </p> or I get the following error when I click the update button Any help appreciated Server Error in '/PortalCSVS' Application. -------------------------------------------------------------------------------- A potentially dangerous Request.Form value was detected from the client (DesktopText="<p> Mitch’s Code of ..."). Description: Request Validation has detected a p...

Use of <code>, <var>, <kbd>, and <samp>
Is there any policy as to whether <code>, <var>, <kbd> and <samp> can all be used, and if so, whether they should only be used for XUL, etc. or other code documented at the site, or whether they can also be used to refer to code which is not intended as the subject of any documentation, but which is used as an example. For example, the template tutorial indicates that <content>'s @uri attribute can be set to any variable name, such as "?start" or "?uri". Could these be referenced with <var> too, or is it the policy to co...

VB <<<>>> C#
it will be usefull to have a good Vb C# | C# Vb translatorangiras I'll ask around and see if I can find out if we're planning to offer translation. In the meantime, you can find a number of them on the web, and you can also look into the DTE (our automation model) Code Model - you may be able to use it to do some interesting forms of translation. -ScottThis posting is provided "AS IS" with no warranties, and confers no rights. I have never heard about this code model ! thanksangiras they say Namespace: EnvDTE I cannot find it is it Microsofz.Win32 ?angiras The EnvDTE DL...

.. ~~~!!!~~~ ================================================== ================================================== CLICK HERE TO ENTER: >>> <<< ================================================== ================================================== .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ....

>>>> BUY RAM <<<<
.. ~~~*@@@*~~~ ================================================== ================================================== ENTER HERE: >>> <<< ================================================== ================================================== .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ...

C<< >> vs C<< >> vs C<< x >>
Ugh. So we all know that there's this syntax for formatting codes (n=E9s "interio= r sequences") like C<< x >>. And that tokenizes as three tokens: "C<< ", open-C code "x", content " >>" close-code matching the C open-code And this is explicated by what I wrote in perlpodspec where I say that such a code... * starts with a capital letter (just US-ASCII [A-Z]) followed by two or more "<"'s, one or more whitespace characters, * any number of characters * one or more whit...

Web resources about - this in <% using Html.Form<ProductController>(p=>p.Update(ViewData.Product.ProductID))%> -

Resources last updated: 1/6/2016 9:42:13 PM