I need to do something like this is this possible?
<%
var Controller = null;
if (Model.ID== "ABC")
    开发者_JAVA技巧{
        Controller = "Name";
    }
    else
    {
        Controller = "Detail";
    }
%>
<% using (Html.BeginForm("edit", Controller, FormMethod.Post, new { @id="exc-" + Model.SID}))
   {%>
<%= Html.Summary(true)%>
Is this possible?
If i do I am getting exception:
ERROR: Cannot assign to an implicitly-typed local variable
Why not just do:
<% var Controller = (Model.ID == "ABC") ? "Name" : "Details" %> 
EDIT: Based in your update do:
<% using (Html.BeginForm("edit", 
    (Model.ID == "ABC") ? "Name" : "Details", FormMethod.Post,
    new { @id="exc-" + Model.SID})) 
   { %>
You could also use your code that you editted and just change var to string.
<%
var Controller = null;
if (Model.ID == "ABC")
    {
        Controller = "Name";
    }
    else
    {
        Controller = "Details";
    }
%>
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论