or
hi,
My name is Francisco, I update 2010 Q2 to 2011 Q2 ASP NET and my grid don't work, before update working fine.
When i click edit button of a row, show me a error in the status bar of Internet Explorer version 8.
The error message is:
<telerik:GridTemplateColumn UniqueName="colCustomerName"> <HeaderStyle BorderWidth="0pt" BorderStyle="Solid" Width="30%" ></HeaderStyle> <HeaderTemplate> <table align="center" cellpadding="0pt" > <tr id="blank" style="padding:0pt 0pt 0pt 0pt"> <td style="padding:0pt 0pt 0pt 0pt"> </td> </tr> <tr align="center" style="padding:0pt 0pt 0pt 0pt" > <td style="width:365pt; border-top:solid thin black;background-color:#d3dfd3; padding:0pt 0pt 0pt 0pt"> Customer </td> </tr> </table> </HeaderTemplate>
<telerik:RadAjaxLoadingPanel ID="editDetailsLoadingPanel" runat="server" Skin="Vista" Transparency="30" /><telerik:RadAjaxPanel ID="editDetailsPanel" runat="server" LoadingPanelID="editDetailsLoadingPanel"> <table> <tr> <td><asp:Label ID="editDetailsCostCtrLbl" Text="Cost Center:" runat="server" /></td> <td><telerik:RadTextBox ID="editDetailsCostCtrTxt" runat="server" EmptyMessage="Enter Cost Center"/></td> </tr> <tr> <td><asp:Label ID="editDetailsAuxLocLbl" Text="Aux Location: " runat="server" /></td> <td><telerik:RadTextBox ID="editDetailsAuxLocTxt" runat="server" EmptyMessage="Enter Aux Location"/></td> </tr> <tr> <!-- START PAR VALUE REGION --> <td colspan="2"> <asp:Label ID="editDetailsParValueGridLbl" Text="Set Par Values" runat="server" /> <telerik:RadGrid ID="itemsParValueGrid" runat="server" AutoGenerateColumns="false" AllowPaging="true" Width="500px" OnNeedDataSource="itemsParValueGrid_NeedDataSource" OnItemCommand="itemsParValueGrid_ItemCommand" AllowAutomaticUpdates="false" AllowAutomaticInserts="false"> <MasterTableView CommandItemDisplay="Top" EnableNoRecordsTemplate="true" ShowHeadersWhenNoRecords="true"> <NoRecordsTemplate> <div>There are no records to display</div> </NoRecordsTemplate> <Columns> <telerik:GridEditCommandColumn /> <telerik:GridBoundColumn UniqueName="ID" DataField="ID" Visible="false" /> <telerik:GridBoundColumn UniqueName="Description" DataField="Description" HeaderText="Description" ReadOnly="true" /> <telerik:GridBoundColumn UniqueName="PSNum" DataField="PSNum" HeaderText="PS #" ReadOnly="true"/> <telerik:GridBoundColumn UniqueName="Min" DataField="Min" HeaderText="Min" /> <telerik:GridBoundColumn UniqueName="Max" DataField="Max" HeaderText="Max" /> </Columns> <EditFormSettings EditFormType="Template"> <FormTemplate> <table> <tr> <td colspan="2"> <telerik:RadTextBox ID="parValueFilterTxt" EmptyMessage="Search PS # ..." runat="server" Width="200px" ClientEvents-OnKeyPress="filterList" /> </td> </tr> <tr> <td> <telerik:RadListBox ID="RadListBox1" runat="server" AllowTransfer="true" Height="200px" Width="230px" SelectionMode="Multiple" TransferToID="RadListBoxTransfer" OnClientDropped="OnClientDroppedHandler" OnDeleted="RadListBox1_ItemDeleted" AutoPostBackOnTransfer="true"/> </td> <td> <telerik:RadListBox ID="RadListBoxTransfer" runat="server" Height="200px" Width="200px" SelectionMode="Multiple" OnLoad="listboxload" OnDeleted="RadListBoxTransfer_ItemDeleted"/> </td> </tr> <tr> <td colspan="2"> <telerik:RadButton ID="ParValueListBoxBtn" runat="server" Text="Save" CommandName="Save" /> </td> </tr> </table> </FormTemplate> </EditFormSettings> <CommandItemSettings ShowRefreshButton="false" /> </MasterTableView> </telerik:RadGrid> </td> <!-- END PAR VALUE REGION --> </tr> <tr> <td colspan="2"><telerik:RadButton ID="editDetailsUpdateBtn" runat="server" Text="Update" OnClick="editDetailsUpdateBtn_Click" AutoPostBack="true" /></td> </tr> </table></telerik:RadAjaxPanel> private static List<string> addedParValue; private static List<string> removedParValue; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { editDetailsAuxLocTxt.Text = AssetWhere.Admin_new.editDetailsAuxLoc; editDetailsCostCtrTxt.Text = AssetWhere.Admin_new.editDetailsCostCtr; } } protected void editDetailsUpdateBtn_Click(object sender, EventArgs e) { string AuxLocation = editDetailsAuxLocTxt.Text; string CostCenter = editDetailsCostCtrTxt.Text; string LocationID = AssetWhere.Admin_new.editDetailsLocationID; SqlCommand editDetailsUpdateCmd = new SqlCommand("UPDATE dbo.locations SET CostCenter='" + CostCenter + "', AuxLocationID='" + AuxLocation + "' WHERE ID ='" + LocationID + "'", connection); connection.Open(); editDetailsUpdateCmd.ExecuteNonQuery(); connection.Close(); } protected void itemsParValueGrid_NeedDataSource(object sender, EventArgs e) { // Bind the Location Par Value Grid itemsParValueGrid.DataSource = GetDataTable("SELECT ItemParValues.ID, items.Description,items.CrossRefID as [PSNum],ItemParValues.Min,ItemParValues.Max FROM dbo.ItemParValues INNER JOIN dbo.items ON items.ID = ItemParValues.ItemID WHERE ItemParValues.LocationID = '" + AssetWhere.Admin_new.editDetailsLocationID + "' AND items.Tracking='1' ORDER BY [Min] ASC, [MAX] ASC, [PSNum] ASC"); } public DataTable GetDataTable(string queryString) { using (SqlCommand cmd = new SqlCommand(queryString, connection)) { SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); return dt; } } protected void listboxload(object sender, EventArgs e) { // Search for controls RadListBox rlbSource = (RadListBox)((GridItem)((Control)sender).NamingContainer).FindControl("RadListBox1"); RadListBox rlbDest = (RadListBox)((GridItem)((Control)sender).NamingContainer).FindControl("RadListBoxTransfer"); RadTextBox txt = (RadTextBox)((GridItem)((Control)sender).NamingContainer).FindControl("parValueFilterTxt"); // Command for getting the source and dest PS Numbers SqlCommand getSourcePSNum = new SqlCommand("SELECT items.CrossRefID, items.ID FROM dbo.items WHERE Tracking='1' AND CrossRefID NOT IN (SELECT items.CrossRefID FROM dbo.items inner join dbo.ItemParValues on items.ID = ItemParValues.ItemID WHERE ItemParValues.LocationID='" + AssetWhere.Admin_new.editDetailsLocationID + "' AND items.Tracking='1') ORDER BY items.CrossRefID ASC", connection); SqlCommand getDestPSNum = new SqlCommand("SELECT items.CrossRefID, items.ID FROM dbo.items inner join dbo.ItemParValues on items.ID = ItemParValues.ItemID WHERE ItemParValues.LocationID='" + AssetWhere.Admin_new.editDetailsLocationID + "' AND items.Tracking='1' ORDER BY items.CrossRefID ASC", connection); // Add Source PS Numbers to ListBox connection.Open(); SqlDataReader sourceRdr = getSourcePSNum.ExecuteReader(); while (sourceRdr.Read()) { rlbSource.Items.Add(new RadListBoxItem(sourceRdr.GetString(0), sourceRdr.GetGuid(1).ToString())); } sourceRdr.Close(); // Add Dest PS Numbers to ListBox SqlDataReader destRdr = getDestPSNum.ExecuteReader(); while (destRdr.Read()) { rlbDest.Items.Add(new RadListBoxItem(destRdr.GetString(0), destRdr.GetGuid(1).ToString())); } destRdr.Close(); connection.Close(); // Register Javascript for the TextBox string script = "var listbox;var filterTextBox;function pageLoad(){listbox = $find('" + rlbSource.ClientID + "');filterTextBox = document.getElementById('" + txt.ClientID + "');listbox._getGroupElement().focus();}function OnClientDroppedHandler(sender, eventArgs){eventArgs.get_sourceItem().set_text(clearTextEmphasis(eventArgs.get_sourceItem().get_text()));}function filterList(){clearListEmphasis();createMatchingList();}function clearListEmphasis(){var re = new RegExp('</{0,1}em>', 'gi');var items = listbox.get_items();var itemText;items.forEach(function(item){itemText = item.get_text();item.set_text(clearTextEmphasis(itemText));})}function clearTextEmphasis(text){var re = new RegExp('</{0,1}em>', 'gi');return text.replace(re, '');}function createMatchingList(){var items = listbox.get_items();var filterText = filterTextBox.value;var re = new RegExp(filterText, 'i');items.forEach(function(item){var itemText = item.get_text();if (itemText.toLowerCase().indexOf(filterText.toLowerCase()) != -1){item.set_text(itemText.replace(re, '<em>' + itemText.match(re) + '</em>'));item.set_visible(true);}else{item.set_visible(false);}})}"; ScriptManager.RegisterStartupScript(this, this.GetType(), "key22", script, true); } protected void itemsParValueGrid_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { if (e.CommandName == RadGrid.InitInsertCommandName) { e.Item.OwnerTableView.EditMode = GridEditMode.PopUp; e.Item.OwnerTableView.EditFormSettings.PopUpSettings.Modal = true; e.Item.OwnerTableView.EditFormSettings.PopUpSettings.Width = 500; e.Item.OwnerTableView.EditFormSettings.PopUpSettings.Height = 300; e.Item.OwnerTableView.EditFormSettings.InsertCaption = "Add/Remove Item ParValue Tracking"; } else if (e.CommandName == RadGrid.EditCommandName) { e.Item.OwnerTableView.EditMode = GridEditMode.InPlace; } else if (e.CommandName == RadGrid.UpdateCommandName) { GridEditableItem editedItem = e.Item as GridEditableItem; TextBox parValueDescription = (TextBox)editedItem["Description"].Controls[0]; TextBox parValuePSNum = (TextBox)editedItem["PSNum"].Controls[0]; TextBox parValueMin = (TextBox)editedItem["Min"].Controls[0]; TextBox parValueMax = (TextBox)editedItem["Max"].Controls[0]; TextBox parValueID = (TextBox)editedItem["ID"].Controls[0]; SqlCommand updateParValues = new SqlCommand("UPDATE dbo.ItemParValues SET Min='" + parValueMin.Text + "', Max='" + parValueMax.Text + "' WHERE ID='" + parValueID.Text + "' AND LocationID='" + AssetWhere.Admin_new.editDetailsLocationID + "'", connection); connection.Open(); updateParValues.ExecuteNonQuery(); connection.Close(); } else if (e.CommandName == "Save") { // Set variables int i = 0; int x = 0; Guid ParValueID = new Guid(); // Setup search GridEditableItem editedItem = e.Item as GridEditableItem; RadListBox rlbSource = (editedItem.FindControl("RadListBox1") as RadListBox); RadListBox rlbDest = (editedItem.FindControl("RadListBoxTransfer") as RadListBox); while (addedParValue != null && i < addedParValue.Count()) { ParValueID = Guid.NewGuid(); // Insert new parvalues connection.Open(); SqlCommand insertParValues = new SqlCommand("INSERT INTO dbo.ItemParValues (ID, LocationID, ItemID, CriticalLevel, Min, Max) VALUES ('" + ParValueID.ToString() + "', '" + AssetWhere.Admin_new.editDetailsLocationID + "', '" + addedParValue[i] + "', '0', '0', '0')", connection); insertParValues.ExecuteNonQuery(); connection.Close(); i++; } while (removedParValue != null && x < removedParValue.Count()) { connection.Open(); // Remove old parvalues SqlCommand deleteParValues = new SqlCommand("DELETE FROM dbo.ItemParValues WHERE ItemID='" + removedParValue[x] + "' AND LocationID='" + AssetWhere.Admin_new.editDetailsLocationID + "'", connection); deleteParValues.ExecuteNonQuery(); connection.Close(); x++; } } } protected void RadListBox1_ItemDeleted(object sender, RadListBoxEventArgs e) { // Initialize List addedParValue = new List<string>(); removedParValue = new List<string>(); // Clear list so we can start fresh addedParValue.Clear(); // Add all inserted items to list foreach (RadListBoxItem item in e.Items) { // Check to see if it already exists in the list if (!addedParValue.Contains(item.Value.ToString())) addedParValue.Add(item.Value.ToString()); // Remove the value if it exists in the source list // needed if you move a value back and forth in one session if (removedParValue.Contains(item.Value.ToString())) removedParValue.Remove(item.Value.ToString()); } } protected void RadListBoxTransfer_ItemDeleted(object sender, RadListBoxEventArgs e) { // Initialize List addedParValue = new List<string>(); removedParValue = new List<string>(); // Clear list so we can start fresh removedParValue.Clear(); // Add all inserted items to list foreach (RadListBoxItem item in e.Items) { // Check to see if it already exists in the list if (!removedParValue.Contains(item.Value.ToString())) removedParValue.Add(item.Value.ToString()); // Remove the value if it exists in the source list // needed if you move a value back and forth in one session if (addedParValue.Contains(item.Value.ToString())) addedParValue.Remove(item.Value.ToString()); } } }