This code has an overflow issue. Please look right upper corner and end of tab panel. Couldn't able to find the error. Can anyone suggest a solution. I used mudbalzor as a library. going to implement a blazor hybrid app for tabs.
<MudGrid Justify="Justify.Center">
<MudAppBar Style="background-color:#053B71;color:white;width:contain" Fixed="false" Dense="false" DisableGutters="false" Class="mt-2">
<MudIconButton Icon="#Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" Class="ml-2" />
<MudText Class="ml-4" Style="font-weight:800;font-size:large">BLX Super Mart</MudText>
<MudSpacer />
<MudIconButton Icon="#Icons.Material.Filled.Logout" Style="color:white;background-color:aqua" Href="/" Class="ml-2" />
</MudAppBar>
<MudGrid >
<MudItem xs="7" Style="background-color:yellow">
<MudTabs Elevation="2" Rounded="true" PanelClass="pa-6" PrevIcon="#Icons.Material.Filled.SkipPrevious" NextIcon="#Icons.Material.Filled.SkipNext"
AlwaysShowScrollButtons="true" Color="#Color.Primary" Style="border:thin;border-color:darkgray;border-radius:10px">
#foreach (string category in tabscat)
{
<MudTabPanel Text=#category ToolTip="Choose a Category" OnClick="() => LoadItems(category)" >
<MudGrid>
#foreach (var item in tabscatitm)
{
}
</MudGrid>
</MudTabPanel>
}
</MudTabs>
</MudItem>
</MudGrid>
Try move you MudAppBar outside of the main MudGrid and use the MudLayout component
<MudLayout>
<MudAppBar Style="background-color:#053B71;color:white;width:contain" Fixed="false" Dense="false" DisableGutters="false" Class="mt-2">
<MudIconButton Icon="#Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" Class="ml-2" />
<MudText Class="ml-4" Style="font-weight:800;font-size:large">BLX Super Mart</MudText>
<MudSpacer />
<MudIconButton Icon="#Icons.Material.Filled.Logout" Style="color:white;background-color:aqua" Href="/" Class="ml-2" />
</MudAppBar>
<MudMainContent>
<MudContainer MaxWidth="MaxWidth.Medium">
<MudGrid Justify="Justify.Center">
<MudGrid>
<MudItem xs="7" Style="background-color:yellow">
<MudTabs Elevation="2" Rounded="true" PanelClass="pa-6" PrevIcon="#Icons.Material.Filled.SkipPrevious" NextIcon="#Icons.Material.Filled.SkipNext"
AlwaysShowScrollButtons="true" Color="#Color.Primary" Style="border:thin;border-color:darkgray;border-radius:10px">
<MudTabPanel Text="AAAA" ToolTip="Choose a Category" >
<MudGrid>
</MudGrid>
</MudTabPanel>
<MudTabPanel Text="BBBB" ToolTip="Choose a Category" >
<MudGrid>
</MudGrid>
</MudTabPanel>
<MudTabPanel Text="CCCC" ToolTip="Choose a Category" >
<MudGrid>
</MudGrid>
</MudTabPanel>
</MudTabs>
</MudItem>
</MudGrid>
</MudGrid>
</MudContainer>
</MudMainContent>
</MudLayout>
https://try.mudblazor.com/snippet/camducPHecwyvTIz
Related
I'm new in the Telerik UI. When I want to customize a kendo form in asp.net razor pages. But I to rename button name. But I couldn't find any button field. I follow this link [Telerik Form][1]. I edit this form.
This is my code
<div class="card dataForm mb-3">
<div class="demo-section">
<kendo-form layout="grid" name="exampleForm" method="POST">
<form-items>
<form-item type="group" layout="grid">
<grid cols="6" />
<item-label text="Income Information - list every person living in the home" />
<form-items>
<form-item field="Name" col-span="1">
<item-label text="Name:"/>
</form-item>
<form-item field="Age" col-span="1">
<item-label text="Age:"/>
</form-item>
<form-item field="Relationship" col-span="1">
<item-label text="Relationship:"/>
</form-item>
<form-item field="Income" col-span="1">
<item-label text="Income:"/>
</form-item>
<form-item field="SourceOfIncome" col-span="1">
<item-label text="Source of Income:"/>
</form-item>
<form-item field="EBCIRoll" col-span="1">
<item-label text="EBCI Roll:" />
</form-item>
</form-items>
</form-item>
</form-items>
</kendo-form>
</div>
</div>
<style>
#example .demo-section {
max-width: 600px;
width: 600px;
}
</style>
How to control this form?
[1]: https://demos.telerik.com/aspnet-core/form/layout
With the TagHelper you need to set the buttons-template or buttons-template-id attribute. The first accepts the template as string the second the external template. Here is an example of the second option
<kendo-form buttons-template-id="myTemplate" layout="grid" form-data="#Model" name="exampleForm" on-validate-field="onFormValidateField" on-submit="onFormSubmit" on-clear="onFormClear" action="Layout" method="POST">
...
</kendo-form>
<script type="text/x-kendo-template" id="myTemplate">
<button class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-primary k-form-submit" type="submit">
<span class="k-button-text">Custom Submit Button</span>
</button>
<button class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-form-clear">
<span class="k-button-text">Clear</span>
</button>
I have got a infragistics webdatagrid in my page, and on top of that page, i have got a webdatamenu with 2 buttons, one for refreshing the page, and the other for save the data from the grid.
What i am doing is a day scheduler.
here is my webdatagrid..
<ig:WebDataGrid ID="WebDataGridPlaneamentoHorarios" Visible="false" runat="server" Height="500px"
AutoGenerateColumns="False" Width="1300px" BorderColor="#666666"
ShowFooter="True" EnableDataViewState="True" >
<Columns>
<ig:BoundDataField DataFieldName="Numero" Key="Numero" Width="100px" Hidden="false">
<Header Text="Número" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="Nome" Key="Nome" Width="100px">
<Header Text="Nome" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="Descricao" Key="Descricao" Width="150px" Hidden="false">
<Header Text="Profissão" />
<Footer TemplateId="footerTemplate" />
</ig:BoundDataField>
<ig:TemplateDataField Key="Segmentos" Width="1510px" Hidden="False">
<ItemTemplate>
<uc1:Segmento ID="Segmento1" runat="server" />
</ItemTemplate>
<HeaderTemplate >
<uc5:HeaderControl ID="SegHed" runat="server"/>
</HeaderTemplate>
<FooterTemplate >
<div id="Quant" runat="server"> <uc2:SegNecessidades ID="SegNecessidades" runat="server" /></div>
<br /><br /> <div id="Totais" runat="server"><uc2:SegNecessidades ID="SegNecessidades2" runat="server" /></div>
<br /><br />
</FooterTemplate>
</ig:TemplateDataField>
<ig:BoundDataField DataFieldName="IDProfissao" Width="50px" Hidden="true" Key="IDProfissao">
<Header Text="IDProfissão" />
</ig:BoundDataField>
</Columns>
<Templates>
<ig:ItemTemplate ID="WebDataGridPlaneamentoHorariosTemplate2" runat="server"
TemplateID="footerTemplate">
<Template >
<uc3:FooterControl ID="FooterC" runat="server" />
</Template>
</ig:ItemTemplate>
</Templates>
</ig:WebDataGrid>
Everything is working fine, on refresh, the data is loaded...the problem is when i try to save the changes...
protected void WebDataMenuOptions_ItemClick(object sender, Infragistics.Web.UI.NavigationControls.DataMenuItemEventArgs e)
{
if (e.Item.Key == "btnRefrescar")
{
foreach (GridRecord row in WebDataGridPlaneamentoHorarios.Rows)
{
GridRecordItem itm = row.Items[3];
string id = row.Items[0].Text;
Control control = itm.FindControl("Segmento1");
DataTable DTblHorarioById = dbcHorariosEscalas.GetHorarioById(id, dt);
Segmentos seg = (Segmentos)control;
seg.AddSegmento(id, DTblHorarioById);
//this is to load the schedule of the user,,,,
}
}
else if(e.Item.Key == "btnGuardar")
{
foreach (GridRecord row in WebDataGridPlaneamentoHorarios.Rows)
{
GridRecordItem itm = row.Items[3];
string id = row.Items[0].Text;
Control control = itm.FindControl("Segmento1");
}
}
}
So the code is the same in both buttons, i am trying to find the user control called Segmento1, that is in the 4 column...
Now the code works when refresh button is pressed, the user control is found, but when i press the button save, the control is null...what is the problem...i am going nuts with this, because yesterday it was working, and then today it stoped, i think is one of those programming problems when the code works and stop working just because he wants..
please I'm stock in this error and i can't get rid of it i have a user control inside another user control the child control contain RadAjaxPanel.
the parent control contain a Radgrid wish have an editformTemplate and the child control is loaded inside it i'll show u in code :
<EditFormSettings EditFormType="Template">
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
<FormStyle BackColor="#FCFCFC"></FormStyle>
<FormTemplate>
<table>
<tr>
<td class="LblWidth" style="padding-top: 5px;">
<asp:Label ID="Label1" runat="server" Text="Center logo:">
</asp:Label>
</td>
<td style="padding-top: 10px;">
<uc1:MAYAUploadImageControl ID="UploadImageControl1" runat="server" />
<span class="redSpan">
</span>
</td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
that is the parent control
the child control is :
<telerik:RadAjaxPanel ID="ajaxPanel" runat="server" >
<asp:HiddenField ID="hf_FileName" runat="server" />
<asp:HiddenField ID="ImageChanged" runat="server" Value="0" />
<asp:Label ID="Label1" runat="server" Text="New Picture:"></asp:Label>
<br />
<telerik:RadImageEditor ID="RIEditor" runat="server" Width="180" Height="150" ToolBarMode="Default"
EnableResize="false" EnableTheming="false" BackColor="Transparent" OnImageSaving="ImageEditor_ImageSaving"
StatusBarMode="Hidden" CanvasMode="No" ToolBarPosition="top" BorderStyle="Solid"
BorderWidth="0px" Visible="false" OnClientImageLoad="ImageLoad" OnClientImageChanged="ImageChanged">
<Tools>
<telerik:ImageEditorToolGroup>
<telerik:ImageEditorTool CommandName="Flip" />
<telerik:ImageEditorTool CommandName="FlipVertical" />
<telerik:ImageEditorTool CommandName="FlipHorizontal" />
<telerik:ImageEditorToolSeparator />
<telerik:ImageEditorTool CommandName="Crop" />
<telerik:ImageEditorTool CommandName="Resize" />
<telerik:ImageEditorToolSeparator />
<telerik:ImageEditorTool CommandName="Reset" />
</telerik:ImageEditorToolGroup>
</Tools>
</telerik:RadImageEditor>
</telerik:RadAjaxPanel>
parent control ascx.cs:
protected void GridCenters_ItemCommand(object sender,Telerik.Web.UI.GridCommandEventArgs e)
{
if (e.CommandName == RadGrid.UpdateCommandName || e.CommandName == RadGrid.PerformInsertCommandName)
{ controls_CustomControls_UploadImageControl_Maya ctrl = e.Item.FindControl("UploadImageControl1") as controls_CustomControls_UploadImageControl_Maya;
if (ctrl.ImageFileName != "")
{
//string imageFileName = (e.Item.FindControl("AsyncUpload1") as RadAsyncUpload).UploadedFiles[0].FileName;
ctrl.SaveImage();
logo = ctrl.ImageFileName != "" ? ConvertImgToBinary(ctrl.ImageFileName) : null;
}
switch (e.CommandName)
{
case "Update":
if(!EntertainmentDataAccess.UpdateCenter(long.Parse(e.CommandArgument.ToString()), centerName, centerType, logo, website, "", isactive, "", mail, tel, Mobile, fax, country, casa, town, street, BuildNb, POB))
{
LblError.Text = "Branch cannot be updated";
}
else
{
LblError.Text = "Branch updated successfully";
GridEditCommandColumn editColumn = (GridEditCommandColumn)GridCenters.MasterTableView.GetColumn("EDIT");
editColumn.Visible = true;
GridCenters.DataBind(); // here i'm getting the error
}
break;
}
}
I'm sorry for my messy explanation but i'm stuck for days in this problem and i cldn't resolve it
Based on the info in the links below, it looks like the RadAjaxPanel is being moved or removed from the Control Collection it belongs to. The third link contains a Telerik-specific workaround.
What causes the 'Cannot unregister UpdatePanel' error?
"Cannot unregister UpdatePanel with ID 'xxx' since it was not registered with the ScriptManager... " in RadGrid while editing record
http://www.telerik.com/support/kb/aspnet-ajax/window/cannot-unregister-updatepanel-with-id-updatepanelid-since-it-was-not-registered-with-the-scriptmanager.aspx
http://msmvps.com/blogs/luisabreu/archive/2006/11/16/adding-removing-updatepanels-dynamicaly-from-a-page.aspx
Using C# I have extracted data from Google Analytics Data API and have got it in an xmldocument. From that point I want to export it to flat file format (txt file). I am trying to use the xmlnode class to write out element attribute values within the 'entry' elements but cant do it. XML code below:
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dxp="http://schemas.google.com/analytics/2009" xmlns:openSearch="http://a9.com/- /spec/opensearch/1.1/">
<id>https://www.googleapis.com/analytics/v2.4/data?ids=ga:xxxxxxxxx&dimensions=ga:date,ga:hostname&metrics=ga:visits,ga:newVisits,ga:visitBounceRate,ga:transactions,ga:transactionRevenue,ga:itemQuantity&start-date=2012-09-20&end-date=2012-09-26&start-index=1&max-results=1000</id>
<updated>2012-09-27T08:08:53.621Z</updated>
<title type="text">Google Analytics Data for Profile xxxxxxxxx</title>
<link rel="self" type="application/atom+xml" href="https://www.googleapis.com/analytics/v2.4/data?ids=ga:xxxxxxxxx&dimensions=ga:date,ga:hostname&metrics=ga:visits,ga:newVisits,ga:visitBounceRate,ga:transactions,ga:transactionRevenue,ga:itemQuantity&start-date=2012-09-20&end-date=2012-09-26&start-index=1&max-results=1000" />
<author>
<name>Google Analytics</name>
</author>
<generator>Google Analytics</generator>
<openSearch:totalResults>49</openSearch:totalResults>
<openSearch:startIndex>1</openSearch:startIndex>
<openSearch:itemsPerPage>1000</openSearch:itemsPerPage>
<dxp:aggregates>
<dxp:metric name="ga:visits" type="integer" value="942258" />
<dxp:metric name="ga:newVisits" type="integer" value="393698" />
<dxp:metric name="ga:visitBounceRate" type="percent" value="26.960025810340692" />
<dxp:metric name="ga:transactions" type="integer" value="328" />
<dxp:metric name="ga:transactionRevenue" type="currency" value="427646.331187" />
<dxp:metric name="ga:itemQuantity" type="integer" value="322" />
</dxp:aggregates>
<dxp:containsSampledData>true</dxp:containsSampledData>
<dxp:dataSource>
<dxp:property name="ga:profileId" value="xxxxxxxxx" />
<dxp:property name="ga:webPropertyId" value="UA-33036832-1" />
<dxp:property name="ga:accountName" value="TCO-UK-TC.com-[thomascook.com]" />
<dxp:tableId>ga:xxxxxxxxx</dxp:tableId>
<dxp:tableName>ThomasCook UK - Analytics Extract (VP /search)</dxp:tableName>
</dxp:dataSource>
<dxp:endDate>2012-09-26</dxp:endDate>
<dxp:startDate>2012-09-20</dxp:startDate>
<entry>
<id>https://www.googleapis.com/analytics/v2.4/data?ids=ga:xxxxxxxxx&ga:date=20120920&ga:hostname=87.248.112.8&start-date=2012-09-20&end-date=2012-09-26</id>
<updated>2012-09-27T08:08:53.621Z</updated>
<title type="text">ga:date=20120920 | ga:hostname=87.248.112.8</title>
<link rel="alternate" type="text/html" href="http://www.google.com/analytics" />
<dxp:dimension name="ga:date" value="20120920" />
<dxp:dimension name="ga:hostname" value="87.248.112.8" />
<dxp:metric name="ga:visits" type="integer" value="3" />
<dxp:metric name="ga:newVisits" type="integer" value="3" />
<dxp:metric name="ga:visitBounceRate" type="percent" value="100.0" />
<dxp:metric name="ga:transactions" type="integer" value="0" />
<dxp:metric name="ga:transactionRevenue" type="currency" value="0.0" />
<dxp:metric name="ga:itemQuantity" type="integer" value="0" />
</entry>
<entry>
<id>https://www.googleapis.com/analytics/v2.4/data?ids=ga:xxxxxxxxx&ga:date=20120920&ga:hostname=alpha.thomascook.com&start-date=2012-09-20&end-date=2012-09-26</id>
<updated>2012-09-27T08:08:53.621Z</updated>
<title type="text">ga:date=20120920 | ga:hostname=alpha.thomascook.com</title>
<link rel="alternate" type="text/html" href="http://www.google.com/analytics" />
<dxp:dimension name="ga:date" value="20120920" />
<dxp:dimension name="ga:hostname" value="alpha.thomascook.com" />
<dxp:metric name="ga:visits" type="integer" value="160" />
<dxp:metric name="ga:newVisits" type="integer" value="109" />
<dxp:metric name="ga:visitBounceRate" type="percent" value="21.25" />
<dxp:metric name="ga:transactions" type="integer" value="0" />
<dxp:metric name="ga:transactionRevenue" type="currency" value="0.0" />
<dxp:metric name="ga:itemQuantity" type="integer" value="0" />
</entry>
....so on.....
In the code below I need to change it to locate the entry elements, but can't find it. Using "/entry" yields nothing.
XmlNamespaceManager xmlnsm = new XmlNamespaceManager(xmld.NameTable);
xmlnsm.AddNamespace("dxp", "http://schemas.google.com/analytics/2009");
xmlnsm.AddNamespace("openSearch", "http://a9.com/-/spec/opensearch/1.1/");
xmlnsm.AddNamespace("gd", "http://schemas.google.com/g/2005");
foreach (XmlNode xmlnd in xmld.SelectNodes("//dxp:dimension", xmlnsm))
{
DimVal = xmlnd.Attributes["value"].Value.ToString();
DimName = xmlnd.Attributes["name"].Value.Replace("ga:", "");
// ...
}
I could be missing a namespace. Can anyone please help me out?
XDocument xDoc = XDocument.Load(fileToLoad); //or XDocument.Parse(xmlString)
XNamespace dxp = "http://schemas.google.com/analytics/2009";
XNamespace ns = "http://www.w3.org/2005/Atom";
var result =
xDoc.Descendants(ns + "entry")
.Select(e => new
{
Dimension = e.Descendants(dxp + "dimension")
.ToDictionary(d => d.Attribute("name").Value, d => d.Attribute("value").Value),
Metric = e.Descendants(dxp + "metric")
.ToDictionary(d => d.Attribute("name").Value, d => d.Attribute("value").Value)
})
.ToList();
Print the result:
foreach(var entry in result)
{
foreach (var dim in entry.Dimension)
Console.WriteLine(dim.Key + " = " + dim.Value);
Console.WriteLine();
foreach (var met in entry.Metric)
Console.WriteLine(met.Key + " = " + met.Value);
Console.WriteLine("---------------");
}
If you're just interested in getting all of the dxp:dimension elements you could use
GetElementsByTagName("dimension", "http://schemas.google.com/analytics/2009")
instead of
SelectNodes("//dxp:dimension", xmlnsm)
If you're intent on using SelectNodes, I think you need another / ("///dxp:dimension").
Specifically for your case you can do:
foreach(XmlElement ele in xmld.GetElementsByTagName("element"))
{
foreach(XmlElement dim in ele.GetElementsByTagName("dimension", "http://schemas.google.com/analytics/2009")
{
// Do w/e w/ the element
}
foreach(XmlElement met in ele.GetElementsByTagName("metric", "http://schemas.google.com/analytics/2009")
{
// Do w/e w/ the element
}
}
I have a peculiar problem - I have a ViewModel with a List in it used to display a list of images:
public List<int> TrackerKeys { get; set; }
This is used in two places in the page:
#for (int i = 0; i < Model.TrackerKeys.Count(); i++)
{
#Html.GenerateImage(PageModes.Http, Model.TrackerKeys[i])
}
And also
#for (int i = 0; i < Model.TrackerKeys.Count(); i++)
{
#Html.HiddenFor(model => model.TrackerKeys[i])
}
This is sat inside a form - when the form is submitted, if a validation error occurs, the TrackerKeys property is updated with a new random set of numbers. I am passing the previous list back to ensure the user does not see the same image again.
Tracker keys is correctly set and passed back to the View.
My problem is:
The images correctly display the new images based on the new values in the list
However
The values of the hidden fields are not updated to the new values - they retain the original values.
Any ideas? Is this a bug with MVC3? any input would be greatly appreciated. Thank you.
Edit
Html before submission:
<img alt="Security Character" height="35" src="http://localhost:51414/content/imagescss/26.gif" width="35" />
<img alt="Security Character" height="35" src="http://localhost:51414/content/imagescss/33.gif" width="35" />
<img alt="Security Character" height="35" src="http://localhost:51414/content/imagescss/8.gif" width="35" />
<img alt="Security Character" height="35" src="http://localhost:51414/content/imagescss/30.gif" width="35" />
<img alt="Security Character" height="35" src="http://localhost:51414/content/imagescss/6.gif" width="35" />
<img alt="Security Character" height="35" src="http://localhost:51414/content/imagescss/18.gif" width="35" />
And
<input id="TrackerKeys_0_" name="TrackerKeys[0]" type="hidden" value="26" />
<input id="TrackerKeys_1_" name="TrackerKeys[1]" type="hidden" value="33" />
<input id="TrackerKeys_2_" name="TrackerKeys[2]" type="hidden" value="8" />
<input id="TrackerKeys_3_" name="TrackerKeys[3]" type="hidden" value="30" />
<input id="TrackerKeys_4_" name="TrackerKeys[4]" type="hidden" value="6" />
<input id="TrackerKeys_5_" name="TrackerKeys[5]" type="hidden" value="18" />
And after the post:
correct new values here...
<img alt="Security Character" height="35" src="http://localhost:51414/content/imagescss/16.gif" width="35" />
<img alt="Security Character" height="35" src="http://localhost:51414/content/imagescss/20.gif" width="35" />
<img alt="Security Character" height="35" src="http://localhost:51414/content/imagescss/11.gif" width="35" />
<img alt="Security Character" height="35" src="http://localhost:51414/content/imagescss/19.gif" width="35" />
<img alt="Security Character" height="35" src="http://localhost:51414/content/imagescss/26.gif" width="35" />
<img alt="Security Character" height="35" src="http://localhost:51414/content/imagescss/15.gif" width="35" />
and...
still retaining old values...
<input id="TrackerKeys_0_" name="TrackerKeys[0]" type="hidden" value="26" />
<input id="TrackerKeys_1_" name="TrackerKeys[1]" type="hidden" value="33" />
<input id="TrackerKeys_2_" name="TrackerKeys[2]" type="hidden" value="8" />
<input id="TrackerKeys_3_" name="TrackerKeys[3]" type="hidden" value="30" />
<input id="TrackerKeys_4_" name="TrackerKeys[4]" type="hidden" value="6" />
<input id="TrackerKeys_5_" name="TrackerKeys[5]" type="hidden" value="18" />
controller action
[HttpPost]
public ActionResult EmployerRegistration(EmployerViewModel Model)
{
if (ModelState.IsValid)
{
//do bits here
}
Model.TrackerKeys = Helper.GenerateNewNumbers(Model.TrackerKeys);
return View(Model);
}
Is this a bug with MVC3?
Oh no, that's by design and it is how all HTML helpers work in ASP.NET MVC. HTML helpers (such as Html.TextBoxFor, Html.HiddenFor, ...) first look at the ModelState when binding their values and after that they look at the Model. So if you intend to modify some property of your model inside the POST controller action and this property was part of the POST body, you will have to remove the old values from the ModelState first:
[HttpPost]
public ActionResult EmployerRegistration(EmployerViewModel Model)
{
if (ModelState.IsValid)
{
//do bits here
}
// we clear all values from the modelstate => this will ensure that
// the helpers will use the values from the model and not those that
// were part of the initial POST.
ModelState.Clear();
Model.TrackerKeys = Helper.GenerateNewNumbers(Model.TrackerKeys);
return View(Model);
}
or if you don't want to clear the entire ModelState (as this will remove all values and any corresponding modelstate errors that might be associated to them) you could remove only those keys that you actually modify:
[HttpPost]
public ActionResult EmployerRegistration(EmployerViewModel Model)
{
if (ModelState.IsValid)
{
//do bits here
}
for (var i = 0; i < Model.TrackerKeys.Count; i++)
{
ModelState.Remove(string.Format("TrackerKeys[{0}]", i));
}
Model.TrackerKeys = Helper.GenerateNewNumbers(Model.TrackerKeys);
return View(Model);
}