Loss of web control data when switching from one page to another in webgrid located on aspx page

Hey. I had a webgrid on my aspx page with paging when I try to go from one page to another page of a web page. I am losing data from other controls on an aspx page. Basically, a web page, when navigating from one page to another, tries to reload the entire aspx page.

My question is how to make this webgrid separately on my aspx page and not reload the page when mvoing from one page to another

Thank you in advance

    <html>
<head>
    <title>Index</title>
    <style type="text/css">
        .webGrid { margin: 4px; border-collapse: collapse; width: 300px; }
        .header { background-color: #E8E8E8; font-weight: bold; color: #FFF; }
        .webGrid th, .webGrid td { border: 1px solid #C0C0C0; padding: 5px; }
        .alt { background-color: #E8E8E8; color: #000; }
        .person { width: 200px; font-weight:bold;}
    </style>
</head>
<body>            
    @{
        var grid = new WebGrid(Model, canPage: true, rowsPerPage: 5);
        grid.Pager(WebGridPagerModes.NextPrevious);
        @grid.GetHtml(tableStyle: "webGrid",
                htmlAttributes: new { id = "DataTable" },
                headerStyle: "header",
                alternatingRowStyle: "alt",
                columns: grid.Columns(
                    grid.Column("Age"),
                    grid.Column("Id"),
                    grid.Column("Name")
        ));       
    }
    <input type="text" id="somed" /><select><option value="some">test1</option><option value="some2">test2</option><option value="some3">test3</option></select>
</body>
</html>

Here I have a text box and a drop down menu, so whenever I try to go from one page to another, the value in the text box and the selected values โ€‹โ€‹of the drop-down list will disappear.

+3

All Articles