This is a migrated thread and some comments may be shown as answers.

How do I get values out of the grid

0 Answers 40 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Natalie
Top achievements
Rank 1
Natalie asked on 27 Jan 2011, 07:54 PM
OK, here's my problem. My view is using a class model that displays school info in textboxes. Then below it, the grid displays a list of students attending that school. I'm able to populate the grid no problem. However, on postback, only the school info is passed back and and not the student info in the grid. How do I get at the data in the grid so I can put it back into the class? Please someone help, and give me an example in VB.NET.

Here's a code snippet of what I'm doing:

<%  Using Html.BeginForm("School", "Report", Nothing, FormMethod.Post)%>
<table id="tblSchool" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
    <td>Official School Name:</td>
    <td><%=Html.TextBoxFor(Function(m) m.District.School.OfficialName)%></td>
    <td> </td><td> </td>
</tr>
<tr>
    <td>Telephone:</td><td><%=Html.TextBoxFor(Function(m) m.District.School.Telephone)%></td>
    <td>Fax:</td><td><%=Html.TextBoxFor(Function(m) m.District.School.Fax)%></td>
</tr
<tr>
    <td>Address Line 1:</td><td><%=Html.TextBoxFor(Function(m) m.District.School.Address.Line1)%></td>
    <td>Address Line 2:</td><td><%=Html.TextBoxFor(Function(m) m.District.School.Address.Line2)%></td>
</tr>
<tr>
    <td colspan="4">
    <%
        Dim gridBuilder = Html.Telerik().Grid(Of DistrictSchoolStudentListStudent).Name("Grid").Pageable() 
          
        'Add grid columns
           
        gridBuilder.Columns(Function(columns) columns.Bound("ID").Width(5).Title("ID").HeaderHtmlAttributes(New With {.style = "white-space:pre;height:90px;width:30px;"}))
        gridBuilder.Columns(Function(columns) columns.Bound("FamilyName").Width(5).Title("Family Name"))
        gridBuilder.Columns(Function(columns) columns.Bound("FirstName").Width(5).Title("First Name"))
        gridBuilder.Columns(Function(columns) columns.Bound("Gender").Width(5).Title("Gender"))
        gridBuilder.Columns(Function(columns) columns.Bound("Grade").Width(5).Title("Grade"))
              
          
        gridBuilder.BindTo(Model.District.School.StudentList.Student)
          
        gridBuilder.Render()
  
    %>  
    </td>
</tr>
</table>


Thanks!
Tags
Grid
Asked by
Natalie
Top achievements
Rank 1
Share this question
or