Bonjour,
Comme indiqué dans le titre, dès que je pagine ou que je trie par colonne, la valeur de mes bouton radio saute. withPhot revient sur indiff et isActive n'est plus coché du tout.
Les valeurs sont bien passées au contrôleur et renvoyées dans le ViewBag

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
 
@using (Html.BeginForm("Index", "Product", new
{
    page = ViewBag.CurrentPage,
    sortOrder = ViewBag.CurrentOrder,
    customerId = ((SelectList)ViewBag.CustomerId).SelectedValue,
    providerId = ((SelectList)ViewBag.ProviderId).SelectedValue,
    withPhoto = ViewBag.WithPhoto,
    operationId = ((SelectList)ViewBag.OperationId).SelectedValue,
    productTypeId = ((SelectList)ViewBag.ProductTypeId).SelectedValue,
    customerStockID = ((SelectList)ViewBag.CustomerStockID).SelectedValue,
    productLineID = ((SelectList)ViewBag.ProductLineID).SelectedValue,
    product = ViewBag.Product,
    familyID = ((SelectList)ViewBag.FamilyID).SelectedValue,
    isActiv = ViewBag.IsActiv,
    buyerId = ((SelectList)ViewBag.BuyerId).SelectedValue
}, FormMethod.Get))
{
 
    <div class="form-horizontal">
        <div class="form-group">
            <div class="col-md-11">
                <h2>Liste des Articles</h2>
            </div>
            <div class="col-md-1">
                <br />
                <br />
                @Html.ActionLink(" ", "Create", "Product", null, new { @class = "glyphicon glyphicon-plus btn btn-primary", @title = "Ajouter un article" })
            </div>
        </div>
        <hr />
    </div>
    <div class="form-horizontal">
        <div class="form-group">
            <div class="col-md-10 col-md-offset-1">
                <h3>Filtrer les articles sur :</h3>
            </div>
            <div class="col-md-1">
                <button type="submit" class="btn btn-primary" title="Rechercher">
                    <span class="glyphicon glyphicon-search"></span>
                </button>
            </div>
        </div>
        <div class="row">
            <div class="col-md-6">
                <div class="row">
                    <div class="form-group">
                        <div class="col-md-2">
                            @Html.LabelFor(model => model.FirstOrDefault().Product.ProductLine.CustomerStock.Customer.Name, new { @class = "control-label" })
                        </div>
                        <div class="col-md-4">
                            @Html.DropDownList("CustomerID", (SelectList)ViewBag.CustomerId, "<Tous>", new { @id = "SelectCustomer", @class = "btn btn-default dropdown-toggle" })
                        </div>
                        <div class="col-md-2">
                            @Html.LabelFor(model => model.FirstOrDefault().Product.ProductType.Label, new { @class = "control-label" })
                        </div>
                        <div class="col-md-4">
                            @Html.DropDownList("ProductTypeID", (SelectList)ViewBag.ProductTypeID, "<Tous>", new { @id = "selectedType", @class = "btn btn-default dropdown-toggle" })
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group">
                        <div class="col-md-2">
                            @Html.LabelFor(model => model.FirstOrDefault().Product.Family.Label, new { @class = "control-label" })
                        </div>
                        <div class="col-md-4">
                            @Html.DropDownList("FamilyID", (SelectList)ViewBag.FamilyID, "<Toutes>", new { @id = "selectedType", @class = "btn btn-default dropdown-toggle" })
                        </div>
                        <div class="col-md-2">
                            @Html.LabelFor(model => model.FirstOrDefault().Product.Label, new { @class = "control-label" })
                        </div>
                        <div class="col-md-4">
                            @Html.Editor("product", new { htmlAttributes = new { @class = "form-control" } })
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group">
                        <div class="col-md-2">
                            @Html.LabelFor(model => model.FirstOrDefault().Product.PhotoPath, new { @class = "control-label" })
                        </div>
                        <div class="col-md-4">
                            <label class="radio-inline">@Html.RadioButton("withPhoto", "true") Oui</label>
                            <label class="radio-inline">@Html.RadioButton("withPhoto", "false") Non</label>
                            <label class="radio-inline">@Html.RadioButton("withPhoto", "null", true) Indif</label>
                        </div>
                        <div class="col-md-2">
                            @Html.Label("Produits actifs", new { @class = "control-label" })
                        </div>
                        <div class="col-md-4">
                            <label class="radio-inline">@Html.RadioButton("isActiv", "true", true) Oui</label>
                            <label class="radio-inline">@Html.RadioButton("isActiv", "false") Non</label>
                            <label class="radio-inline">@Html.RadioButton("isActiv", "null") Indif</label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                @Html.Partial("PartialDependantDropDowns", new Logsys.Geolie.Anima.Mvc.Models.ProductProductLine())
            </div>
        </div>
    </div>
}
 
@if (Model != null && Model.Count > 0)
{
    <div class="table-responsive">
        <table class="table table-striped table-hover table-condensed table-responsive">
            <tr>
                <th width="5%">
                    @Html.ActionLink(HttpUtility.HtmlDecode(Html.DisplayNameFor(model => model.FirstOrDefault().Product.ProductID).ToHtmlString()), "Index", new { sortOrder = ViewBag.SortById, page = ViewBag.CurrentPage, customerId = ((SelectList)ViewBag.CustomerId).SelectedValue, providerId = ((SelectList)ViewBag.ProviderId).SelectedValue, operationId = ((SelectList)ViewBag.OperationId).SelectedValue, productTypeId = ((SelectList)ViewBag.ProductTypeId).SelectedValue, customerStockID = ((SelectList)ViewBag.CustomerStockID).SelectedValue, productLineID = ((SelectList)ViewBag.ProductLineID).SelectedValue, product = ViewBag.Product, familyID = ((SelectList)ViewBag.FamilyID).SelectedValue, isActiv = ViewBag.IsActiv, buyerId = ((SelectList)ViewBag.BuyerId).SelectedValue })
                </th>
                <th width="5%">
                    @Html.ActionLink(HttpUtility.HtmlDecode(Html.DisplayNameFor(model => model.FirstOrDefault().Product.CustomerProductID).ToHtmlString()), "Index", new { sortOrder = ViewBag.SortByCustProdId, page = ViewBag.CurrentPage, customerId = ((SelectList)ViewBag.CustomerId).SelectedValue, providerId = ((SelectList)ViewBag.ProviderId).SelectedValue, operationId = ((SelectList)ViewBag.OperationId).SelectedValue, productTypeId = ((SelectList)ViewBag.ProductTypeId).SelectedValue, customerStockID = ((SelectList)ViewBag.CustomerStockID).SelectedValue, productLineID = ((SelectList)ViewBag.ProductLineID).SelectedValue, product = ViewBag.Product, familyID = ((SelectList)ViewBag.FamilyID).SelectedValue, isActiv = ViewBag.IsActiv, buyerId = ((SelectList)ViewBag.BuyerId).SelectedValue })
                </th>
                <th width="5%">
                    @Html.ActionLink(HttpUtility.HtmlDecode(Html.DisplayNameFor(model => model.FirstOrDefault().Product.Label).ToHtmlString()), "Index", new { sortOrder = ViewBag.SortByLabel, page = ViewBag.CurrentPage, customerId = ((SelectList)ViewBag.CustomerId).SelectedValue, providerId = ((SelectList)ViewBag.ProviderId).SelectedValue, operationId = ((SelectList)ViewBag.OperationId).SelectedValue, productTypeId = ((SelectList)ViewBag.ProductTypeId).SelectedValue, customerStockID = ((SelectList)ViewBag.CustomerStockID).SelectedValue, productLineID = ((SelectList)ViewBag.ProductLineID).SelectedValue, product = ViewBag.Product, familyID = ((SelectList)ViewBag.FamilyID).SelectedValue, isActiv = ViewBag.IsActiv, buyerId = ((SelectList)ViewBag.BuyerId).SelectedValue })
                </th>
                <th width="5%">
                    @Html.ActionLink(HttpUtility.HtmlDecode(Html.DisplayNameFor(model => model.FirstOrDefault().Product.CreationDate).ToHtmlString()), "Index", new { sortOrder = ViewBag.SortByCreaDate, page = ViewBag.CurrentPage, customerId = ((SelectList)ViewBag.CustomerId).SelectedValue, providerId = ((SelectList)ViewBag.ProviderId).SelectedValue, operationId = ((SelectList)ViewBag.OperationId).SelectedValue, productTypeId = ((SelectList)ViewBag.ProductTypeId).SelectedValue, customerStockID = ((SelectList)ViewBag.CustomerStockID).SelectedValue, productLineID = ((SelectList)ViewBag.ProductLineID).SelectedValue, product = ViewBag.Product, familyID = ((SelectList)ViewBag.FamilyID).SelectedValue, isActiv = ViewBag.IsActiv, buyerId = ((SelectList)ViewBag.BuyerId).SelectedValue })
                </th>
                <th width="5%">
                    @Html.ActionLink(HttpUtility.HtmlDecode(Html.DisplayNameFor(model => model.FirstOrDefault().ProductLine.CustomerStock.Name).ToHtmlString()), "Index", new { sortOrder = ViewBag.SortByCusStk, page = ViewBag.CurrentPage, customerId = ((SelectList)ViewBag.CustomerId).SelectedValue, providerId = ((SelectList)ViewBag.ProviderId).SelectedValue, operationId = ((SelectList)ViewBag.OperationId).SelectedValue, productTypeId = ((SelectList)ViewBag.ProductTypeId).SelectedValue, customerStockID = ((SelectList)ViewBag.CustomerStockID).SelectedValue, productLineID = ((SelectList)ViewBag.ProductLineID).SelectedValue, product = ViewBag.Product, familyID = ((SelectList)ViewBag.FamilyID).SelectedValue, isActiv = ViewBag.IsActiv, buyerId = ((SelectList)ViewBag.BuyerId).SelectedValue })
                </th>
                <th width="5%">
                    @Html.ActionLink(HttpUtility.HtmlDecode(Html.DisplayNameFor(model => model.FirstOrDefault().ProductLine.Label).ToHtmlString()), "Index", new { sortOrder = ViewBag.SortByProdLin, page = ViewBag.CurrentPage, customerId = ((SelectList)ViewBag.CustomerId).SelectedValue, providerId = ((SelectList)ViewBag.ProviderId).SelectedValue, operationId = ((SelectList)ViewBag.OperationId).SelectedValue, productTypeId = ((SelectList)ViewBag.ProductTypeId).SelectedValue, customerStockID = ((SelectList)ViewBag.CustomerStockID).SelectedValue, productLineID = ((SelectList)ViewBag.ProductLineID).SelectedValue, product = ViewBag.Product, familyID = ((SelectList)ViewBag.FamilyID).SelectedValue, isActiv = ViewBag.IsActiv, buyerId = ((SelectList)ViewBag.BuyerId).SelectedValue })
                </th>
                <th width="5%">
                    @Html.ActionLink(HttpUtility.HtmlDecode(Html.DisplayNameFor(model => model.FirstOrDefault().Product.Provider.Name).ToHtmlString()), "Index", new { sortOrder = ViewBag.SortByProv, page = ViewBag.CurrentPage, customerId = ((SelectList)ViewBag.CustomerId).SelectedValue, providerId = ((SelectList)ViewBag.ProviderId).SelectedValue, operationId = ((SelectList)ViewBag.OperationId).SelectedValue, productTypeId = ((SelectList)ViewBag.ProductTypeId).SelectedValue, customerStockID = ((SelectList)ViewBag.CustomerStockID).SelectedValue, productLineID = ((SelectList)ViewBag.ProductLineID).SelectedValue, product = ViewBag.Product, familyID = ((SelectList)ViewBag.FamilyID).SelectedValue, isActiv = ViewBag.IsActiv, buyerId = ((SelectList)ViewBag.BuyerId).SelectedValue })
                </th>
                <th width="5%">
                    @Html.ActionLink(HttpUtility.HtmlDecode(Html.DisplayNameFor(model => model.FirstOrDefault().Product.OperationID).ToHtmlString()), "Index", new { sortOrder = ViewBag.SortByOpId, page = ViewBag.CurrentPage, customerId = ((SelectList)ViewBag.CustomerId).SelectedValue, providerId = ((SelectList)ViewBag.ProviderId).SelectedValue, operationId = ((SelectList)ViewBag.OperationId).SelectedValue, productTypeId = ((SelectList)ViewBag.ProductTypeId).SelectedValue, customerStockID = ((SelectList)ViewBag.CustomerStockID).SelectedValue, productLineID = ((SelectList)ViewBag.ProductLineID).SelectedValue, product = ViewBag.Product, familyID = ((SelectList)ViewBag.FamilyID).SelectedValue, isActiv = ViewBag.IsActiv, buyerId = ((SelectList)ViewBag.BuyerId).SelectedValue })
                </th>
                <th width="5%">
                    @Html.ActionLink(HttpUtility.HtmlDecode(Html.DisplayNameFor(model => model.FirstOrDefault().Product.Operation.Label).ToHtmlString()), "Index", new { sortOrder = ViewBag.SortByOp, page = ViewBag.CurrentPage, customerId = ((SelectList)ViewBag.CustomerId).SelectedValue, providerId = ((SelectList)ViewBag.ProviderId).SelectedValue, operationId = ((SelectList)ViewBag.OperationId).SelectedValue, productTypeId = ((SelectList)ViewBag.ProductTypeId).SelectedValue, customerStockID = ((SelectList)ViewBag.CustomerStockID).SelectedValue, productLineID = ((SelectList)ViewBag.ProductLineID).SelectedValue, product = ViewBag.Product, familyID = ((SelectList)ViewBag.FamilyID).SelectedValue, isActiv = ViewBag.IsActiv, buyerId = ((SelectList)ViewBag.BuyerId).SelectedValue })
                </th>
                <th width="5%">
                    @Html.ActionLink(HttpUtility.HtmlDecode(Html.DisplayNameFor(model => model.FirstOrDefault().Product.ReceptionPackaging.Label).ToHtmlString()), "Index", new { sortOrder = ViewBag.SortByExpP, page = ViewBag.CurrentPage, customerId = ((SelectList)ViewBag.CustomerId).SelectedValue, providerId = ((SelectList)ViewBag.ProviderId).SelectedValue, operationId = ((SelectList)ViewBag.OperationId).SelectedValue, productTypeId = ((SelectList)ViewBag.ProductTypeId).SelectedValue, customerStockID = ((SelectList)ViewBag.CustomerStockID).SelectedValue, productLineID = ((SelectList)ViewBag.ProductLineID).SelectedValue, product = ViewBag.Product, familyID = ((SelectList)ViewBag.FamilyID).SelectedValue, isActiv = ViewBag.IsActiv, buyerId = ((SelectList)ViewBag.BuyerId).SelectedValue })
                </th>
                <th width="5%">
                    @Html.ActionLink(HttpUtility.HtmlDecode(Html.DisplayNameFor(model => model.FirstOrDefault().Product.ReceptionPackagingQuantity).ToHtmlString()), "Index", new { sortOrder = ViewBag.SortByExpQ, page = ViewBag.CurrentPage, customerId = ((SelectList)ViewBag.CustomerId).SelectedValue, providerId = ((SelectList)ViewBag.ProviderId).SelectedValue, operationId = ((SelectList)ViewBag.OperationId).SelectedValue, productTypeId = ((SelectList)ViewBag.ProductTypeId).SelectedValue, customerStockID = ((SelectList)ViewBag.CustomerStockID).SelectedValue, productLineID = ((SelectList)ViewBag.ProductLineID).SelectedValue, product = ViewBag.Product, familyID = ((SelectList)ViewBag.FamilyID).SelectedValue, isActiv = ViewBag.IsActiv, buyerId = ((SelectList)ViewBag.BuyerId).SelectedValue })
                </th>
                <th width="5%">
                    TODO
                </th>
                <th width="5%">
                    @Html.ActionLink(HttpUtility.HtmlDecode(Html.DisplayNameFor(model => model.FirstOrDefault().Product.UnitWeight).ToHtmlString()), "Index", new { sortOrder = ViewBag.SortByUnitWei, page = ViewBag.CurrentPage, customerId = ((SelectList)ViewBag.CustomerId).SelectedValue, providerId = ((SelectList)ViewBag.ProviderId).SelectedValue, operationId = ((SelectList)ViewBag.OperationId).SelectedValue, productTypeId = ((SelectList)ViewBag.ProductTypeId).SelectedValue, customerStockID = ((SelectList)ViewBag.CustomerStockID).SelectedValue, productLineID = ((SelectList)ViewBag.ProductLineID).SelectedValue, product = ViewBag.Product, familyID = ((SelectList)ViewBag.FamilyID).SelectedValue, isActiv = ViewBag.IsActiv, buyerId = ((SelectList)ViewBag.BuyerId).SelectedValue })
                </th>
                <th width="5%">
                    @Html.ActionLink(HttpUtility.HtmlDecode(Html.DisplayNameFor(model => model.FirstOrDefault().Product.ProductType.Label).ToHtmlString()), "Index", new { sortOrder = ViewBag.SortByTyp, page = ViewBag.CurrentPage, customerId = ((SelectList)ViewBag.CustomerId).SelectedValue, providerId = ((SelectList)ViewBag.ProviderId).SelectedValue, operationId = ((SelectList)ViewBag.OperationId).SelectedValue, productTypeId = ((SelectList)ViewBag.ProductTypeId).SelectedValue, customerStockID = ((SelectList)ViewBag.CustomerStockID).SelectedValue, productLineID = ((SelectList)ViewBag.ProductLineID).SelectedValue, product = ViewBag.Product, familyID = ((SelectList)ViewBag.FamilyID).SelectedValue, isActiv = ViewBag.IsActiv, buyerId = ((SelectList)ViewBag.BuyerId).SelectedValue })
                </th>
                <th width="5%">
                    @Html.DisplayNameFor(model => model.FirstOrDefault().Product.BuyingPrice)
                </th>
                <th width="5%">
                    @Html.DisplayNameFor(model => model.FirstOrDefault().Product.SellingPrince)
                </th>
                <th width="5%">
                    @Html.ActionLink(HttpUtility.HtmlDecode(Html.DisplayNameFor(model => model.FirstOrDefault().Product.IsActiv).ToHtmlString()), "Index", new { sortOrder = ViewBag.SortByActiv, page = ViewBag.CurrentPage, customerId = ((SelectList)ViewBag.CustomerId).SelectedValue, providerId = ((SelectList)ViewBag.ProviderId).SelectedValue, operationId = ((SelectList)ViewBag.OperationId).SelectedValue, productTypeId = ((SelectList)ViewBag.ProductTypeId).SelectedValue, customerStockID = ((SelectList)ViewBag.CustomerStockID).SelectedValue, productLineID = ((SelectList)ViewBag.ProductLineID).SelectedValue, product = ViewBag.Product, familyID = ((SelectList)ViewBag.FamilyID).SelectedValue, isActiv = ViewBag.IsActiv, buyerId = ((SelectList)ViewBag.BuyerId).SelectedValue })
                </th>
                <th width="5%"></th>
            </tr>
            @foreach (var item in Model)
            {
                <tr>
                    <td width="5%">
                        @Html.ActionLink(item.ProductID, "Details", new { id = item.Product.ProductID }, new { @title = "Détail" })
                    </td>
                    <td width="5%">
                        @Html.DisplayFor(modelItem => item.Product.CustomerProductID)
                    </td>
                    <td width="15%">
                        @Html.DisplayFor(modelItem => item.Product.Label)
                    </td>
                    <td width="5%">
                        @Html.DisplayFor(modelItem => item.Product.CreationDate)
                    </td>
                    <td width="5%">
                        @Html.DisplayFor(modelItem => item.ProductLine.CustomerStock.Name)
                    </td>
                    <td width="5%">
                        @Html.DisplayFor(modelItem => item.ProductLine.Label)
                    </td>
                    <td width="5%">
                        @Html.DisplayFor(modelItem => item.Product.Provider.Name)
                    </td>
                    <td width="5%">
                        @Html.DisplayFor(modelItem => item.Product.OperationID)
                    </td>
                    <td width="5%">
                        @Html.DisplayFor(modelItem => item.Product.Operation.Label)
                    </td>
                    <td width="5%">
                        @Html.DisplayFor(modelItem => item.Product.ReceptionPackaging.Label)
                    </td>
                    <td width="5%">
                        @Html.DisplayFor(modelItem => item.Product.ReceptionPackagingQuantity)
                    </td>
                    <td width="5%">
                        subquery -> unités en stocks
                    </td>
                    <td width="5%">
                        @Html.DisplayFor(modelItem => item.Product.UnitWeight)
                    </td>
                    <td width="5%">
                        @Html.DisplayFor(modelItem => item.Product.ProductType.Label)
                    </td>
                    <td width="5%">
                        @Html.DisplayFor(modelItem => item.Product.BuyingPrice)
                    </td>
                    <td width="5%">
                        @Html.DisplayFor(modelItem => item.Product.SellingPrince)
                    </td>
                    <td width="5%">
                        @Html.DisplayFor(modelItem => item.Product.IsActiv)
                    </td>
 
                    <td width="5%">
                        @Html.ActionLink(" ", "Edit", new { id = item.Product.ProductID }, new { @class = "glyphicon glyphicon-pencil", @title = "Modifier" })
                        &nbsp;&nbsp;
                        @Html.ActionLink(" ", "Delete", new { id = item.Product.ProductID }, new { @class = "glyphicon glyphicon-trash", @title = "Supprimer" })
                    </td>
                </tr>
            }
        </table>
 
        Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount
        @Html.PagedListPager(Model, page => Url.Action("Index", new
   {
       page,
       sortOrder = ViewBag.CurrentOrder,
       customerId = ((SelectList)ViewBag.CustomerId).SelectedValue,
       providerId = ((SelectList)ViewBag.ProviderId).SelectedValue,
       operationId = ((SelectList)ViewBag.OperationId).SelectedValue,
       productTypeId = ((SelectList)ViewBag.ProductTypeId).SelectedValue,
       customerStockID = ((SelectList)ViewBag.CustomerStockID).SelectedValue,
       productLineID = ((SelectList)ViewBag.ProductLineID).SelectedValue,
       product = ViewBag.Product,
       familyID = ((SelectList)ViewBag.FamilyID).SelectedValue,
       isActiv = ViewBag.IsActiv,
       buyerId = ((SelectList)ViewBag.BuyerId).SelectedValue
   }))
    </div>
}

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
        public ActionResult Index(int? page, string sortOrder, string customerId, int? providerId, bool? withPhoto, string operationId, int? productTypeId, int? productLineId, int? customerStockId, string product, int? familyId, bool? isActiv, string buyerId)
        {
            ViewBag.WithPhoto = withPhoto;
            ViewBag.IsActiv = isActiv;
            [...]
un œil extérieur serait le bienvenu.

merci.