<form runat="server" ID="PageForm"> <asp:ScriptManager ID="ScriptManager" runat="server" /><telerik:RadComboBox runat="server" ID="cbSubtype" EmptyMessage="Select a sub-type" DataTextField="Description" DataValueField="Id" AutoPostBack="True" OnSelectedIndexChanged="cbSubtype_SelectedIndexChanged"> </telerik:RadComboBox><telerik:RadGrid ID="rgDocuments" runat="server" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" AllowPaging="True" AllowSorting="True" AllowFilteringByColumn="True" OnNeedDataSource="rgDocuments_NeedDataSource"> <MasterTableView DataKeyNames="DocumentText" Name="DocumentMaster"> <Columns> <telerik:GridBoundColumn DataField="Discipline" HeaderText="[Discipline]" UniqueName="Discipline" /> <telerik:GridHyperLinkColumn DataTextField="DocumentText" HeaderText="[Document]" DataNavigateUrlFields="DocumentUrl" UniqueName="DocumentLink" /> <telerik:GridBoundColumn DataField="Revision" HeaderText="[Rev]" UniqueName="Revision" /> <telerik:GridBoundColumn DataField="Date" HeaderText="[Date]" UniqueName="Date" /> </Columns> </MasterTableView></telerik:RadGrid></form>
public partial class StandardsTypicals : LayoutsPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List<ListBoxGeneralDisplay> list = new List<ListBoxGeneralDisplay>(); list.Add(new ListBoxGeneralDisplay() { Description = "", Id = -1 }); list.Add(new ListBoxGeneralDisplay() { Description = "EG - Std. Specs", Id = 0 }); list.Add(new ListBoxGeneralDisplay() { Description = "EF - Const. Specs", Id = 1 }); list.Add(new ListBoxGeneralDisplay() { Description = "DO - Typicals", Id = 2 }); cbSubtype.DataSource = list; cbSubtype.DataBind(); } } protected void cbSubtype_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { rgDocuments.Rebind(); } protected void rgDocuments_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) { if (cbSubtype.SelectedValue != "-1" && !string.IsNullOrEmpty(cbSubtype.SelectedValue)) { List<RadgridStandardsTypicalsDisplay> displayList = new List<RadgridStandardsTypicalsDisplay>(); displayList.Add(new RadgridStandardsTypicalsDisplay() { Discipline = "Discipline", Date = new DateTime(2013, 04, 01), DocumentText = "Document Text", DocumentUrl = "http://www.google.com", Revision = "A" + cbSubtype.SelectedValue }); displayList.Add(new RadgridStandardsTypicalsDisplay() { Discipline = "Discipline", Date = new DateTime(2013, 04, 01), DocumentText = "Document Text", DocumentUrl = "http://www.google.com", Revision = "A" + cbSubtype.SelectedValue }); displayList.Add(new RadgridStandardsTypicalsDisplay() { Discipline = "Discipline", Date = new DateTime(2013, 04, 01), DocumentText = "Document Text", DocumentUrl = "http://www.google.com", Revision = "A" + cbSubtype.SelectedValue }); rgDocuments.DataSource = displayList; } else { List<RadgridStandardsTypicalsDisplay> displayList = new List<RadgridStandardsTypicalsDisplay>(); rgDocuments.DataSource = displayList; } } }
b.RadComboBox.prototype._getOffsetParentOffset=function(c){var j=0;var f=0;var d=a(c.offsetParent);if(d.css("position")!="static"){var g=d.offset();j=g.top; // BREAK HERE.. G is null.f=g.left;if(c.offsetParent==document.body){var i=parseInt(d.css("top"),10);if(!isNaN(i)){j+=i;}var h=parseInt(d.css("left"),10);if(!isNaN(h)){f+=h;}}}var e={top:j,left:f};return e;};<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="projects.aspx.vb" Inherits="EPD_WEB_APP.projects" %><%@ Import Namespace="EPD_WEB_APP" %><%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %><%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Charting" TagPrefix="telerik" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Test</title></head><body style="height: 830px; width: 630px"> <form id="form1" runat="server"> <div style="height: 821px; width: 1392px; margin-right: 0px;"> <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> </telerik:RadScriptManager> <br /> <telerik:RadToolBar ID="RadToolBar1" runat="server" Skin="Default" AutoPostBack="True"> </telerik:RadToolBar> <br /> <br /> <asp:Label ID="txtSearchFieldContents" runat="server" Text="Result:"></asp:Label> </div> </form></body></html>Public Class tToolBar Private m_RadToolBar As RadToolBar Private m_ThisPage As System.Web.UI.Page Private m_Skin As String Private m_SearchText As String Public Sub New(ByVal RadToolBar As RadToolBar) m_RadToolBar = RadToolBar m_ThisPage = HttpContext.Current.Handler m_SearchText = "" m_Skin = m_RadToolBar.Skin If Not m_ThisPage.IsPostBack Then Dim btnAdd As New RadToolBarButton() btnAdd.Text = "Add" btnAdd.Value = "1" btnAdd.ImageUrl = "Images/AddRecord.gif" 'btnAdd.CheckOnClick = True m_RadToolBar.Items.Add(btnAdd) Dim btnEdit As New RadToolBarButton() btnEdit.Text = "Edit" btnEdit.Value = "2" 'btnEdit.CheckOnClick = True btnEdit.ImageUrl = "Images/Edit.gif" m_RadToolBar.Items.Add(btnEdit) Dim buttonS1 As New RadToolBarButton() buttonS1.IsSeparator = True m_RadToolBar.Items.Add(buttonS1) Dim btnSave As New RadToolBarButton() btnSave.Text = "Save" btnSave.Value = "3" btnSave.ImageUrl = "Images/Save.gif" m_RadToolBar.Items.Add(btnSave) Dim btnCancel As New RadToolBarButton() btnCancel.Text = "Cancel" btnCancel.Value = "4" btnCancel.ImageUrl = "Images/Cancel.gif" m_RadToolBar.Items.Add(btnCancel) Dim btnDelete As New RadToolBarButton() btnDelete.Text = "Delete" btnDelete.Value = "5" btnDelete.ImageUrl = "Images/deletex.gif" m_RadToolBar.Items.Add(btnDelete) Dim buttonS2 As New RadToolBarButton() buttonS2.IsSeparator = True m_RadToolBar.Items.Add(buttonS2) Dim ddSearchBy As New RadToolBarSplitButton() ddSearchBy.Text = "Search By..." ddSearchBy.ToolTip = "Select the type of search." Dim btnUPC As New RadToolBarButton() btnUPC.ToolTip = "Select the type of search." btnUPC.Text = "UPC" btnUPC.Value = "UPC" Dim btnDesc As New RadToolBarButton() btnDesc.ToolTip = "Select the type of search." btnDesc.Text = "Description" btnDesc.Value = "DESC" ddSearchBy.Buttons.Add(btnUPC) ddSearchBy.Buttons.Add(btnDesc) m_RadToolBar.Items.Add(ddSearchBy) 'Dim splitButton As New RadToolBarSplitButton() Dim btnSearchByTxt As New RadToolBarButton() btnSearchByTxt.Text = "Search for?" m_RadToolBar.Items.Add(btnSearchByTxt) Dim btnSearch As New RadToolBarButton() btnSearch.Text = "Search" btnSearch.Value = "6" btnSearch.ImageUrl = "Images/search.gif" m_RadToolBar.Items.Add(btnSearch) Dim buttonS3 As New RadToolBarButton() buttonS3.IsSeparator = True m_RadToolBar.Items.Add(buttonS3) Dim btnFirst As New RadToolBarButton() btnFirst.Text = "First" btnFirst.Value = "8" btnFirst.ImageUrl = "Images/blue-first-16.gif" m_RadToolBar.Items.Add(btnFirst) Dim btnPrev As New RadToolBarButton() btnPrev.Text = "Previous" btnPrev.Value = "9" btnPrev.ImageUrl = "Images/blue-prev-16.gif" m_RadToolBar.Items.Add(btnPrev) Dim btnNext As New RadToolBarButton() btnNext.Text = "Next" btnNext.Value = "10" btnNext.ImageUrl = "Images/blue-next-16.gif" m_RadToolBar.Items.Add(btnNext) Dim btnLast As New RadToolBarButton() btnLast.Text = "Last" btnLast.Value = "11" btnLast.ImageUrl = "Images/blue-last-16.gif" m_RadToolBar.Items.Add(btnLast) Disable() End If InstantiateSearch() End Sub Public Property Skin() As String Get Return m_Skin End Get Set(ByVal value As String) m_Skin = value m_RadToolBar.Skin = m_Skin End Set End Property Public Property SearchText() As String Get m_SearchText = "" Dim textItem As RadToolBarItem = m_RadToolBar.FindItemByText("Search for?") Dim textBox As TextBox = CType(textItem.FindControl("TextBox"), TextBox) m_SearchText = textBox.Text Return m_SearchText End Get Set(ByVal value As String) m_SearchText = value Dim textItem As RadToolBarItem = m_RadToolBar.FindItemByText("Search for?") Dim textBox As TextBox = CType(textItem.FindControl("TextBox"), TextBox) textBox.Text = m_SearchText End Set End Property Public Sub InstantiateSearch() Dim searchTemplate As New TextBoxSearchTemplate() Dim textSearchItem As RadToolBarItem = m_RadToolBar.FindItemByText("Search for?") If TypeOf textSearchItem Is RadToolBarButton Then searchTemplate.InstantiateIn(textSearchItem) End If m_RadToolBar.DataBind() End Sub Public Sub Disable(Optional ByVal scope As String = "") If scope = "All" Or scope = "" Then m_RadToolBar.Enabled = False End If ' other options may exist... End Sub Public Sub Enable(Optional ByRef scope As String = "") If scope = "All" Or scope = "" Then m_RadToolBar.Enabled = True End If ' other options may exist... End Sub 'Protected Sub SearchButton_Click(ByVal sender As Object, ByVal e As EventArgs) '----- some way of handling the bar's click, and then inside, which button was clicked, like the "Search" button. '----- this needs to be then handled by the user who is using the class with a tToolBar.OnClick something... 'End Sub Private Class TextBoxSearchTemplate Implements ITemplate Public Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn Dim txtbox1 As New TextBox() txtbox1.ID = "TextBox" txtbox1.Text = "" txtbox1.Font.Size = 10 txtbox1.Font.Bold = False AddHandler txtbox1.DataBinding, AddressOf txtbox1_DataBinding container.Controls.Add(txtbox1) End Sub Private Sub txtbox1_DataBinding(ByVal sender As Object, ByVal e As EventArgs) Dim target As TextBox = DirectCast(sender, TextBox) Dim button As RadToolBarButton = DirectCast(target.BindingContainer, RadToolBarButton) 'Dim buttonText As String = DirectCast(DataBinder.Eval(button, "Text"), String) 'target.Text = buttonText target.Text = "" target.ToolTip = "What do you wish to search for?" End Sub End ClassEnd ClassPublic Class projects Inherits System.Web.UI.Page Private formToolBar As tToolBar Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load formToolBar = New tToolBar(RadToolBar1) formToolBar.Enable() If Not Page.IsPostBack Then 'formToolBar.Skin = "Windows7" Else End If End Sub Protected Sub RadToolBar1_ButtonClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadToolBarEventArgs) Handles RadToolBar1.ButtonClick ' the following just tests whether or not I can access the text from the search textbox. formToolBar.Skin = formToolBar.SearchText txtSearchFieldContents.Text = "Skin: " & formToolBar.Skin ' what I need is a way in the CLASS to dispatch (fire) events per button, ' so that I can have individual handlers in this VB.NET code. ' That way, I don't have to do fancy footwork in the VB.NET, but do all ' the dirty work in the CLASS, and just let the user ' here deal with the inner button. End SubEnd Classfunction startManualUpload() { var tb = $find('<%=tbFileDesc.ClientID%>'); var tbtxt = tb._text.length; if (tbtxt == 0) { } else { var upload = $find('<%=radUpAssoc.ClientID%>'); upload.startUpload(); }}I have an existing app (written by a previous developer) that is calling a stored procedure that populates a RadGrid control. It populates fine the first time around.
However, when I change the date parameter, click "search" button, I get a blank RadGrid control. When I click search the second time, the grid is populated. When I walk through the code, I get an error message
Column 'ID' does not belong to table Table.
How can I resolve the issue of having to click search twice to display data ?
protected void btnSubmit_OnClick(object sender, EventArgs e){ try { ViewState["newset"] = null; CreateDatasource(); this.RadGrid1.DataBind(); this.RadGrid1.CurrentPageIndex = 0; ViewState["newset"] = "new"; string idex = this.hdnindex.Value; if (idex != string.Empty) this.RadGrid1.MasterTableView.Items[int.Parse(idex)].Selected = true; } catch (Exception ex) { this.lblMessage.Text = ex.Message; } }protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e){ try { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; HyperLink hLink = (HyperLink)item["ViewHyperLink"].Controls[0]; if (hLink != null) hLink.Attributes.Add("onclick", "selectMe('" + item.ItemIndex + "');"); } } catch (Exception ex) { this.lblMessage.Text = ex.Message; }}private static TextBox txtName;
In the Page_Load() event, I initialize it:
txtName = (TextBox)RadPanelBar1.FindItemByValue("Add").Controls[0].FindControl("TxtName");
The questions is:
1- I had to make the textbox "static" to make the code work, why?
2- The initialization code didn't work when I put it in the if (!IsPostBack) block, I had to make it run in every page load. why? and is there a better approach to achieve the same functionality?
Has anyone come up with a good solution? I’ve tried so many different ways and still having the problem. I was able to just hard code it on one of my pages because there was only 5 items. One of my other pages has 55 items and I need a fix to this. I have other web pages that will be impacted as well. Any solutions that worked for other folks would be appreciated. Here is one link I’ve tried:
http://stackoverflow.com/questions/5584500/ordered-list-showing-all-zeros-in-ie9
Other situation I tried:
I just tried the code below and have the following error: Microsoft JScript runtime error:
Unable to set value of the property 'innerHTML': object is null or undefined
<!DOCTYPE html>
<HTML>
<HEAD>
<TITLE>IE9 Ordered List Zero Bug</TITLE>
</HEAD>
<BODY>
<DIV id="dv1">
<OL>
<LI>AAA</LI>
<LI>BBB</LI>
</OL>
</DIV>
<DIV id="dv2"></DIV>
<SCRIPT type="text/javascript">
document.getElementById("dv1").innerHTML = "<ol><li>XXX</li><li>YYY</li></ol>";
var container = document.createElement('span');
container.style.display = "none";
document.getElementById("dv2").appendChild(container);
</SCRIPT>
</BODY>
</HTML>
Link:
http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/7b278286-4d47-4556-aa57-cbaf68edeef8