<uc1:Grid ID="Grid1" runat="server" SQL="SELECT * FROM v_Requirement_AllFields" >
<Columns>
<telerik:GridHyperLinkColumn DataNavigateUrlFields="Requirement_RequirementId" DataNavigateUrlFormatString="ViewRequirement.aspx?RequirementId={0}" HeaderText="Reference" DataTextField="Requirement_RequirementReference"></telerik:GridHyperLinkColumn>
</Columns>
</uc1:Grid>
The code in my user control is very simple, basically as follows:
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
For Each col As GridColumn In Columns
telerikGrid.Columns.Add(col)
Next
End If
End Sub
Protected Sub telerikGrid_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles telerikGrid.NeedDataSource
If Not String.IsNullOrEmpty(_sql) Then
telerikGrid.DataSource = GetDataStore(
Me.Page).GetDataTable(_sql)
End If
End Sub
I have tried this with both Ajax enabled or disabled.
Any ideas?

ConfirmText
="Are you sure you want to delete details of" + "<EmployeeName>"
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//CODE TO GET THE POPULATED DATASET STARTS
classMenuListing MenuListing = new classMenuListing();
DataSet ds = new DataSet();
ds = MenuListing.getMenuAgainstRole(ds, 14);
//CODE TO GET THE POPULATED DATASET ENDS
MenuBar.DataFieldID =
"ID";
MenuBar.DataFieldParentID =
"ParentID";
MenuBar.DataNavigateUrlField =
"LinkBasicURL";
MenuBar.DataTextField =
"LinkDisplayText";
MenuBar.DataSource = ds;
MenuBar.DataBind();
}
}
I have a field in the database which provides access keys for each menu item. How will i bind the accesskey field to the radmenu. Like I binded (MenuBar.DataNavigateUrlField = "LinkBasicURL";) URL field.
Thanks,
Mansoor Nadeem
This load the usercontrol - that has a grid with AllowFilteringByColumn="True". When u filter once it works, but any other time or if u click on the edit button inside the grid. You get javascript errors. Only javascript actions cause the error. Any server side action doesn't cause error.
If I don't load the page dynamically and just drag the usercontrol over, there are no problems.
protected void Page_Load(object sender, EventArgs e)
{
UserControl ucControl;
// Insert some whitespace
this.Controls.Add(new LiteralControl("<br />"));
string fileName = Request.QueryString["f"].ToString();
ucControl = (
UserControl)LoadControl("~/Admin/Forms/" + fileName + ".ascx");
ucControl.ID = fileName;
pnlControl.Controls.Add(ucControl);
}
| <rad:RadCodeBlock ID="RadCodeBlock1" runat="server"> |
| // ******** Category Functions ******** |
| function ShowDeleteCategoryForm(categoryID, productID, rowIndex) |
| { |
| // $find instead of window replaced [] with () |
| var grid = window["<%= rgCategory.ClientID %>"]; |
| var rowControl = grid.MasterTableView.Rows[rowIndex].Control; |
| grid.MasterTableView.SelectRow(rowControl, true); |
| window.radopen("Edit_Product/DeleteCategory.aspx?CategoryID=" + categoryID + "&ProductID=" + productID, "DeleteCategory"); |
| return false; |
| } |
| function CloseCategory() |
| { |
| // $find instead of window |
| window["<%= rgCategory.ClientID %>"].AjaxRequest('<%= rgCategory.UniqueID %>', 'RebindAndNavigateCategory'); |
| } |
| </script> |
| </rad:RadCodeBlock> |
| <asp:ScriptManager ID="ScriptManager1" runat="server"> |
| </asp:ScriptManager> |
| <rad:RadGrid ID="rgCategory" runat="server" Visible="false" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" BorderWidth="0px" GridLines="None" Skin="Office2007" ShowStatusBar="True" BorderColor="#BFDBFF" Font-Size="8.5pt" Font-Names="Verdana" CellPadding="5" CellSpacing="5" OnItemCreated="rgCategory_ItemCreated"> |
| <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle> |
| <MasterTableView DataKeyNames="CategoryID,ProductID,SystemID" CommandItemDisplay="Bottom" > |
| <RowIndicatorColumn Visible="False"> |
| <HeaderStyle Width="20px" /> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn Resizable="False" Visible="False"> |
| <HeaderStyle Width="20px" /> |
| </ExpandCollapseColumn> |
| <Columns> |
| <rad:GridBoundColumn DataField="CategoryID" DataType="System.Int32" SortExpression="CategoryID" UniqueName="CategoryID" HeaderText="CategoryID" Visible="False" /> |
| <rad:GridBoundColumn DataField="ProductID" DataType="System.Int32" SortExpression="ProductID" UniqueName="ProductID" HeaderText="ProductID" Visible="False" /> |
| <rad:GridBoundColumn DataField="SystemID" DataType="System.Int32" SortExpression="SystemID" UniqueName="SystemID" HeaderText="SystemID" Visible="False" /> |
| <rad:GridBoundColumn DataField="Name" HeaderText="Category" UniqueName="Name"> |
| <HeaderStyle HorizontalAlign="Center" /> |
| <ItemStyle HorizontalAlign="Center" /> |
| </rad:GridBoundColumn> |
| <rad:GridBoundColumn DataField="Deleted" HeaderText="Deleted" UniqueName="Deleted" Visible="True"> |
| <HeaderStyle HorizontalAlign="Center" /> |
| <ItemStyle HorizontalAlign="Center" /> |
| </rad:GridBoundColumn> |
| <rad:GridBoundColumn DataField="CreatedOn" HeaderText="Created On" UniqueName="CreatedOn"> |
| <HeaderStyle HorizontalAlign="Center" /> |
| <ItemStyle HorizontalAlign="Center" /> |
| </rad:GridBoundColumn> |
| <rad:GridBoundColumn DataField="CreatedBy" HeaderText="Created By" UniqueName="CreatedBy"> |
| <HeaderStyle HorizontalAlign="Center" /> |
| <ItemStyle HorizontalAlign="Center" /> |
| </rad:GridBoundColumn> |
| <rad:GridBoundColumn DataField="LastModifiedOn" HeaderText="Modified On" UniqueName="LastModifiedOn" Visible="False"> |
| <HeaderStyle HorizontalAlign="Center" /> |
| <ItemStyle HorizontalAlign="Center" /> |
| </rad:GridBoundColumn> |
| <rad:GridBoundColumn DataField="LastModifiedBy" HeaderText="Modified By" UniqueName="LastModifiedBy" Visible="False"> |
| <HeaderStyle HorizontalAlign="Center" /> |
| <ItemStyle HorizontalAlign="Center" /> |
| </rad:GridBoundColumn> |
| <rad:GridTemplateColumn UniqueName="TemplateDeleteColumn"> |
| <ItemTemplate> |
| <asp:HyperLink ID="DeleteLink" runat="server"> |
| <asp:Image ID="DeleteCategory" runat="server" ImageUrl="~/RadControls/Grid/Skins/Delete.gif" AlternateText="Delete Category" /> |
| </asp:HyperLink> |
| </ItemTemplate> |
| </rad:GridTemplateColumn> |
| </Columns> |
| <CommandItemTemplate> |
| <div style="text-align: left "> |
| <br /> |
| <asp:HyperLink ID="AddLink" runat="server" Visible="false"> |
| <asp:Image ID="AddRecord1" runat="server" ImageUrl="~/RadControls/Grid/Skins/AddRecord.gif" AlternateText="Add Category" /> |
| Add Category</asp:HyperLink> |
| <br /><br /> |
| </div> |
| </CommandItemTemplate> |
| </MasterTableView> |
| <ClientSettings> |
| <Selecting AllowRowSelect="True" /> |
| </ClientSettings> |
| </rad:RadGrid> |
| <rad:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Office2007" Behavior="Close"> |
| <Windows> |
| <rad:RadWindow ID="DeleteCategory" runat="server" Width="450px" Height="180px" Title="Delete" Skin="Office2007" Modal="true" OnClientClose="CloseCategory" /> |
| <rad:RadWindow ID="AddNewCategory" runat="server" Width="755px" Height="600px" Title="Add New" Skin="Office2007" Modal="true" OnClientClose="CloseCategory" /> |
| </Windows> |
| </rad:RadWindowManager> |
| protected void rgCategory_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) |
| { |
| if (e.Item is GridDataItem) |
| { |
| HyperLink deleteLink = e.Item.FindControl("DeleteLink") as HyperLink; |
| deleteLink.Attributes["href"] = "#"; |
| deleteLink.Attributes["onclick"] = string.Format("return ShowDeleteCategoryForm('{0}','{1}','{2}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["CategoryID"], e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ProductID"], e.Item.ItemIndex); |
| } |
| if (e.Item is GridCommandItem) |
| { |
| HyperLink addLink = e.Item.FindControl("AddLink") as HyperLink; |
| addLink.Visible = true; |
| addLink.Attributes["href"] = "#"; |
| addLink.Attributes["onclick"] = string.Format("return ShowInsertCategoryForm('{0}','{1}');", productID, systemID); |
| } |
| } |
| protected override void RaisePostBackEvent(IPostBackEventHandler sourceControl, string eventArgument) |
| { |
| base.RaisePostBackEvent(sourceControl, eventArgument); |
| if (sourceControl is RadGrid) |
| { |
| switch (eventArgument) |
| { |
| case "RebindAndNavigateCategory": |
| rgCategory.MasterTableView.SortExpressions.Clear(); |
| rgCategory.MasterTableView.GroupByExpressions.Clear(); |
| rgCategoryrgCategory.MasterTableView.CurrentPageIndex = rgCategory.MasterTableView.PageCount - 1; |
| rgCategory.Rebind(); |
| break; |
| } |
| } |
| } |