<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Prospects.ascx.cs" Inherits="Prospects" %> <telerik:RadCodeBlock ID="radcodeProspects" runat="server"> <script type="text/javascript"> function ShowEditForm(id, rowIndex) { alert(id); window.radopen("EditContact.aspx?ContactID=" + id, "UserListDialog"); return false; } function ShowInsertForm() { window.radopen("EditContact.aspx", "UserListDialog"); return false; } function refreshGrid(arg) { if (!arg) { $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind"); } else { $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate"); } } </script> </telerik:RadCodeBlock> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="prospectGrid" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="prospectGrid"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="prospectGrid" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadGrid AllowSorting="true" BackColor="#393939" ID="prospectGrid" runat="server" AllowPaging="true" PageSize="15" Width="980px" CssClass="productsGrid" OnPreRender="prospectGrid_PreRender" OnItemCreated="prospectGrid_ItemCreated" OnNeedDataSource="prospectGrid_NeedDataSource" style="outline:0"> <MasterTableView AutoGenerateColumns="false" PagerStyle-Mode="NextPrevAndNumeric" AllowFilteringByColumn="false" DataKeyNames="OrderID" ClientDataKeyNames="OrderID" TableLayout="Fixed"> <Columns> <telerik:GridBoundColumn DataField="OrderID" HeaderText="ProspectID" AutoPostBackOnFilter="true" ShowFilterIcon="false" HeaderStyle-Width="70px" FilterControlWidth="35px"> </telerik:GridBoundColumn> <telerik:GridNumericColumn DataField="Freight" HeaderText="Freight" DataFormatString="{0:c}" HeaderStyle-Width="110px" FilterControlWidth="60px"> </telerik:GridNumericColumn> <telerik:GridBoundColumn DataField="ShipName" HeaderText="Prospect Name" HeaderStyle-Width="300px" FilterControlWidth="260px"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ShipCountry" HeaderText="Country" FilterControlWidth="70px"> </telerik:GridBoundColumn> <telerik:GridDateTimeColumn DataField="OrderDate" HeaderText="Order Date" DataFormatString="{0:d}" FilterControlWidth="95px"> </telerik:GridDateTimeColumn> <telerik:GridDateTimeColumn DataField="ShippedDate" HeaderText="Shipping Date" DataFormatString="{0:d}" FilterControlWidth="95px"> </telerik:GridDateTimeColumn> <telerik:GridTemplateColumn UniqueName="TemplateEditColumn"> <ItemTemplate> <asp:HyperLink ID="EditLink" runat="server" Text="Edit"></asp:HyperLink> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> <ClientSettings AllowDragToGroup="false" EnableRowHoverStyle="true"> <Selecting AllowRowSelect="true" /> <Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="360px" /> </ClientSettings> </telerik:RadGrid> <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true"> <Windows> <telerik:RadWindow ID="UserListDialog" runat="server" Title="Editing record" Height="320px" Width="310px" Left="150px" ReloadOnShow="true" ShowContentDuringLoad="false" Modal="true" /> </Windows> </telerik:RadWindowManager> <telerik:RadAjaxLoadingPanel ID="ProductsLoadingPanel" runat="server"></telerik:RadAjaxLoadingPanel>protected void prospectGrid_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { HyperLink editLink = (HyperLink)e.Item.FindControl("EditLink"); editLink.Attributes["href"] = "#"; editLink.Attributes["onclick"] = String.Format("return ShowEditForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["OrderID"], e.Item.ItemIndex); } } protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e) { if (e.Argument == "Rebind") { prospectGrid.MasterTableView.SortExpressions.Clear(); prospectGrid.MasterTableView.GroupByExpressions.Clear(); prospectGrid.Rebind(); } else if (e.Argument == "RebindAndNavigate") { prospectGrid.MasterTableView.SortExpressions.Clear(); prospectGrid.MasterTableView.GroupByExpressions.Clear(); prospectGrid.MasterTableView.CurrentPageIndex = prospectGrid.MasterTableView.PageCount - 1; prospectGrid.Rebind(); } }<telerik:RadScriptManager runat="server" ID="RadScriptManager1"> <Scripts> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /> <asp:ScriptReference Path="~/Scripts/jquery.maphilight.min.js" /> <asp:ScriptReference Path="~/Scripts/maphilight.js" /> </Scripts> </telerik:RadScriptManager>function HighlightNode(value) { var tree = $find("<%= RadTreeView1.ClientID %>"); var node = tree.findNodeByValue(value); if (node != null) { node.startEdit(); }}Dim script As String = "HighlightNode(""" + newNode.Value + """)"RadAjaxManager1.ResponseScripts.Add(script)
<telerik:RadGrid ID="RadGrid2" DataSourceID="SqlDataSource3" GridLines="None" ShowGroupPanel="False" Skin="WebBlue" runat="server"
AutoGenerateEditColumn="True" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true">
<ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true" HideStructureColumns="true"></ExportSettings>
<MasterTableView AutoGenerateColumns="False" DataSourceID="SqlDataSource3"
ShowHeader="True" AllowPaging="false" CommandItemDisplay="Top">
<Columns>
<telerik:GridBoundColumn DataField="intInspectorID" DataType="System.Int32" HeaderText="intInspectorID"
SortExpression="intInspectorID" UniqueName="intInspectorID" Visible="false" ReadOnly="true">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="intCertificationID" DataType="System.Int32" HeaderText="intCertificationID"
SortExpression="intCertificationID" UniqueName="intCertificationID" Visible="false" ReadOnly="true">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="strCertificationDesc" HeaderText="Certification" SortExpression="strCertificationDesc"
UniqueName="strCertificationDesc">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="dtmDateExpires" HeaderText="Date Expires" SortExpression="dtmDateExpires"
UniqueName="dtmDateExpires">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn ConfirmText="Delete this Certification?" ButtonType="LinkButton"
CommandName="Delete" Text="Delete" UniqueName="DeleteColumn1">
<HeaderStyle Width="20px" />
<ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
</telerik:GridButtonColumn>
</Columns>
<EditFormSettings EditFormType="Template">
<FormTemplate>
<table style="width:100%; table-layout:fixed; margin: 0 0 0 0; background-color:#E6E6E6;">
<tr>
<td align="right" style=" vertical-align:top;">
<asp:Label ID="Label3" runat="server" Text="Certification:"></asp:Label>
</td>
<td align="left">
<telerik:RadComboBox ID="cboStateEdit" runat="server" DataTextField='<%# Bind("strCertificationDesc") %>'
DataValueField='<%# Bind("intCertificationID") %>' Text='<%# Bind("strCertificationDesc") %>'
SelectedValue='<%# Bind("intCertificationID") %>' Skin="WebBlue">
<Items>
<telerik:RadComboBoxItem Text="--Select--" Value="" />
<telerik:RadComboBoxItem Text="NICET" Value="1" />
<telerik:RadComboBoxItem Text="NICEPT" Value="2" />
<telerik:RadComboBoxItem Text="ACI" Value="3" />
<telerik:RadComboBoxItem Text="PennDOT Concrete" Value="4" />
</Items>
</telerik:RadComboBox>
</td>
</tr>
<tr>
<td align="right" style=" vertical-align:top;">
<asp:Label ID="Label15" runat="server" Text="Date Expires:"></asp:Label>
</td>
<td align="left">
<telerik:RadDatePicker ID="RadDatePicker1" runat="server"
DbSelectedDate='<%# Bind("dtmDateExpires") %>' EnableTyping="false">
</telerik:RadDatePicker>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Button ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'>
</asp:Button>
<asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button>
</td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
</MasterTableView>
</telerik:RadGrid>
<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:inspectors %>"
SelectCommand="getInspectorCertifications" SelectCommandType="StoredProcedure"
InsertCommand="insInspectorCertifications" InsertCommandType="StoredProcedure"
UpdateCommand="updInspectorCertifications" UpdateCommandType="StoredProcedure"
DeleteCommand="delInspectorCertification" DeleteCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="Label1" Name="intInspectorID" PropertyName="Text" Type="Int32" />
</SelectParameters>
<InsertParameters>
<asp:ControlParameter ControlID="Label1" Name="intInspectorID" PropertyName="Text" Type="Int32" />
<asp:Parameter Name="intCertificationID" Type="Int32" />
<asp:Parameter Name="dtmDateExpires" Type="DateTime" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="intCertificationID" Type="Int32" />
<asp:Parameter Name="intInspectorID" Type="Int32" />
<asp:Parameter Name="dtmDateExpires" Type="dateTime" />
</UpdateParameters>
<DeleteParameters>
<asp:Parameter Name="intCertificationID" Type="Int32" />
<asp:Parameter Name="intInspectorID" Type="Int32" />
</DeleteParameters>
</asp:SqlDataSource>
</
telerik:RadPageView>
If I specify a width on the grid and the mastertableview, the grid isn't centered on the screen.
If I remove the width on the grid it is centered.
If I set UseStaticHeaders="False" the command template is the same width as the mastertableview and centered.
If I set UseStaticHeaders="True" the command tamplate width is 100% of the screen and the mastertableview is centered.
We've never been able to use HorizontalAlign="Center" becuase we've never seen it work as expected, so we've been wrapping out grids in a <table> to center them.
Is there something I'm missing?
<telerik:RadGrid ID="RadGrid1" HorizontalAlign="Center" runat="server" AllowPaging="false"
AllowSorting="True" GridLines="None" BorderWidth="0" PageSize="5" BackColor="White"
GroupingEnabled="False" CellSpacing="0" Width="750">
<MasterTableView Name="RepMaster" HorizontalAlign="Center" Width="750" CommandItemDisplay="Top"
BorderStyle="Solid" BorderWidth="1" BorderColor="Black" TableLayout="Fixed">
<CommandItemTemplate>
<table border="0" style="width: 100%;">
<tr>
<td align="left" style="width: 125px;">
<asp:Button CausesValidation="false" CommandName="InitInsert" runat="server" ID="btnAddNewRecord"
Text=" " title="Add new record" CssClass="rgAdd" />
<asp:LinkButton CausesValidation="false" ID="lnkbAddNewRecord" CommandName="InitInsert"
runat="server" CssClass="Link">Add new Record</asp:LinkButton>
</td>
<td align="center">
</td>
<td align="right" style="width: 125px;">
<asp:Button CausesValidation="false" CommandName="RebindGrid" runat="server" ID="btnRefresh"
Text=" " title="Refresh" CssClass="rgRefresh" />
<asp:LinkButton CausesValidation="false" ID="lnkbRefresh" CommandName="RebindGrid"
runat="server" CssClass="Link">Refresh</asp:LinkButton>
</td>
</tr>
</table>
</CommandItemTemplate>
<CommandItemStyle BackColor="AliceBlue" Width="500" HorizontalAlign="Center" />
<Columns>
<telerik:GridTemplateColumn UniqueName="RepMasterEdit" HeaderText="Edit">
<HeaderStyle HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:ImageButton ID="imgbEdit" runat="server" CausesValidation="False" CommandName="Select"
CssClass="Link" ImageUrl="~/Images/btnEdit.gif" ToolTip="Edit" />
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
<ClientSettings EnableRowHoverStyle="True">
<Selecting AllowRowSelect="True" EnableDragToSelectRows="False"></Selecting>
<Scrolling AllowScroll="True" ScrollHeight="100%" UseStaticHeaders="true"></Scrolling>
<ClientEvents OnRowDblClick="RowDblClick" />
</ClientSettings>
</telerik:RadGrid>
Private Sub RadGrid1_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
Dim dt As New DataTable
'Add our columns
For i As Integer = 0 To 5
dt.Columns.Add("Field" + i.ToString, GetType(String))
Next
Dim row As DataRow
For r As Integer = 0 To 50
row = dt.NewRow
For c As Integer = 0 To 5
row("Field" + c.ToString) = "Value " + r.ToString
Next
dt.Rows.Add(row)
Next
Me.RadGrid1.DataSource = dt
End Sub
GridHyperLinkColumn gridHyperLinkColumn = new GridHyperLinkColumn();
gridHyperLinkColumn.AllowFiltering = true;
gridHyperLinkColumn.CurrentFilterFunction = GridKnownFunction.Contains;
gridHyperLinkColumn.ShowFilterIcon = false;
gridHyperLinkColumn.AutoPostBackOnFilter = true; <telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="RadListBox1"> </telerik:RadDataPager> <telerik:RadListBox ID="RadListBox1" runat="server" AutoPostBack="True" DataKeyField="EventLocation" DataSourceID="Listbox" DataTextField="EventLocation" DataValueField="EventLocation" DlisataKeyField="EventLocation" Skin="Black" allowpaging="true" style="z-index: 1; left: 1109px; top: 114px; position: absolute; height: 48px; width: 155px; text-align: center;"> <ButtonSettings TransferButtons="All" /> </telerik:RadListBox>
When i run my aspx page, it doesnt show any pagingI'm trying to write a workaround for the bug in your RadTabStrip control that prevents tabs from being hidden and displayed on demand.
So instead of building the tabstrip with some tabs hidden, I now add only the tab items I want displayed initially, then use javascript to add further tab items later.
Here's a snippet of the js code...
var tabStrip = $find('myTabStrip');var tab = new Telerik.Web.UI.RadTab();tab.set_text('text');tab.set_value('pseudo-id_because_ID_field_is_weirdly_not_supported');var attributes = tab.get_attributes();attributes.setAttribute("onclick", "alert('hello')");tabStrip.get_tabs().insert(1, tab);this runs ok and adds a tab to the page, but the attribute is never set, and when I look at the page source it has never been rendered. The items rendered using server side code with the same settings work fine.
Is there something else I should be doing, or is this another bug?