I built a webgrid which has a value change according on the the base column. My question is there another way to do the refresh then an autopostback, and if not, how do I perform the auto post back without this error:
Multiple controls with the same ID '0_0' were found. FindControl requires that controls have unique IDs. [HttpException (0x80004005): Multiple controls with the same ID '0_0' were found. FindControl requires that controls have unique IDs.] System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls) +273 System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls) +320 System.Web.UI.Control.EnsureNamedControlsTable() +61 System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +222 System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +327 System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +327 System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +327 System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +327 System.Web.UI.Page.FindControl(String id) +38 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +113 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
Here is my code:<ig:WebDataGrid ID="myWebGrid" runat="server" Width="100%" AutoGenerateColumns="False" DataSourceID="values"><Behaviors><ig:ColumnResizing /><ig:Selection CellClickAction="Row" RowSelectType="Multiple"/></Behaviors><Columns><ig:TemplateDataField Key="NameTemplate"><Header Text="Name" /><ItemTemplate><%# Eval("Value.Name")%></ItemTemplate></ig:TemplateDataField><ig:TemplateDataField Key="TypeTemplate"><Header Text="Value Type" /><ItemTemplate><asp:DropDownList runat="server" ID="_valueTypeDropDown" SelectedIndex='<%# Bind("ValueType.ValueType")%>' AutoPostBack=true><asp:ListItem> Frequency </asp:ListItem><asp:ListItem> On Change </asp:ListItem></asp:DropDownList></ItemTemplate></ig:TemplateDataField><ig:TemplateDataField Key="HertzTemplate"><Header Text="Hertz" /><ItemTemplate><asp:TextBox ID="_hertzTextBox" runat="server" Text='<%# Bind("ValueType.Value")%>' Enabled='<%# (Elums.Enterprise.Core.ValueTypeValue.Frequency.Equals(Eval("ValueType.ValueType"))) %>' /></ItemTemplate></ig:TemplateDataField></Columns></ig:WebDataGrid>
We've been running into the same problem using v10.3 SR 2134.
To workaround the issue we've added the following extra WebDataGrid clearing logic (inside the 'doExtraClearingLogic' if block) to be executed only during the re-binds that were causing us to receive the multiple controls with the same ID errors.
grdSelectedHorse.Rows.Clear()grdSelectedHorse.ClearDataSource()If doExtraClearingLogic Then Dim templateControlContainer As PropertyInfo = grdSelectedHorse.GetType.GetProperty("TemplateContainerControl", Reflection.BindingFlags.GetProperty Or Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic) DirectCast(templateControlContainer.GetValue(grdSelectedHorse, Nothing), Control).Controls.Clear()End IfgrdSelectedHorse.DataSource = listgrdSelectedHorse.DataBind()
Note: 'grdSelectedHorse' is our WebDataGrid & 'list' is a Generic.List of anonymous typed objects in our case
Hope this helps someone!
Setting the DataViewState to false works for me!
The DataViewState is not needed because the DataSource will be bound on every Postback.
Hi there,
found out that the problem is prior databindung the myGrid.ClearDataSource() related to this post.
http://blogs.infragistics.com/forums/p/49759/266583.aspx
If you don't call this method it works for me but there is a new problem binding the new datasource to the grid won't work.
Hi Christopher,Based on your description and aspx code, I have put together a sample to reproduce the issue and when run on my machine it works as expected. I have tested my sample with 10.3.20103.1013, 10.3.20103.2056 and 10.3.20103.2073.I have attached the sample project I used to test this. Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem. Please note that I have deleted the ig_res folder from the attached sample because of the restricted size for uploading.If this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one.
Please let me know if you have any questions with this matter.NehaDeveloper Support EngineerInfragisticswww.infragistics.com/support
There is still no fix in 2010.3 SR 2073.