jeudi 6 octobre 2016

string concatenation in aspx view engine using local variable. Not Razor mvc views

How can I string concatenate in ASPX view engine? I want to use my variable in generating ids dynamically(in below example, allow ability to add multiple education details).I want to replace (<%=CurrentEducation%>) with id count. I can easily do this in Razor but not in aspx views. Can you also point me the syntax declarations for <% %> things in aspx view engine please? I can find examples only in razor examples.

 <% dim currentEducation = 1 %>
                                <% for each item As EducationDetailsViewModel in Model.EducationDetails %>
                                <div class="row">
                                    <div class="col-md-11">
                                        <div class="row">
                                            <div class="col-md-3">
                                                <%= Html.LabelFor(Function(x) item.Educationlevel, New With {.class = "control-label" + "test", .id="EducationDetails_(<%=CurrentEducation%>)_EducationLevel"})%><span class="text-danger">*</span>

                                                <%= Html.TextBoxFor(Function(x) item.Educationlevel,New With{.class="form-control"})%>
                                            </div>
                                            <div class="col-md-4">
                                                <%= Html.LabelFor(Function(x) item.SchoolName, New With {.class = "control-label"})%><span class="text-danger">*</span>
                                                <%= Html.TextBoxFor(Function(x) item.SchoolName,New With{.class="form-control"})%>
                                            </div>
                                            <div class="col-md-3">
                                                <%= Html.LabelFor(Function(x) item.YearsAttended, New With {.class = "control-label"})%>
                                                <%= Html.TextBoxFor(Function(x) item.YearsAttended,New With{.class="form-control"})%>
                                            </div>
                                            <div class="col-md-2">
                                                <%= Html.LabelFor(Function(x) item.IsGraduated, New With {.class = "control-label"})%>
                                                <%= Html.RadioButtonFor(Function(x) item.isGraduated, False, new with {.style="width:auto"})%>No:
                                            <%= Html.RadioButtonFor(Function(x) item.isGraduated, True, new with {.style="width:auto"})%>Yes:
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-md-12">
                                                <%= Html.LabelFor(Function(x) item.AreaOfStudy, New With {.class = "control-label"})%>
                                                <div class="">
                                                    <%= Html.TextBoxFor(Function(x) item.AreaOfStudy,New With{.class="form-control"})%>
                                                </div>
                                            </div>
                                        </div>
                                        <br />
                                    </div>
                                    <div class="col-md-1">
                                        <span class="text-danger">X</span>
                                    </div>
                                </div>
                                <% currentEducation = currentEducation + 1 %>
                                <% next %>

Aucun commentaire:

Enregistrer un commentaire