Dim
strScript As String = ""
strScript =
"<script type='text/javascript'>window.open('http://www.google.com'); </script>"
ScriptManager.RegisterStartupScript(GridFees,
Me.GetType(), "myKey", strScript, True)
| <telerik:RadGrid ID="RadGridZoneList" runat="server" GridLines="None" Skin="Vista" |
| AutoGenerateColumns="False" AllowPaging="True" |
| OnPageIndexChanged="RadGridZoneList_PageIndexChanged" |
| GroupingSettings-CaseSensitive="false" EnableLinqExpressions="False" |
| CellPadding="0" AllowFilteringByColumn="True" AllowSorting="True" |
| OnItemCommand="RadGridZoneList_ItemCommand" OnInit="RadGridZoneList_Init"> |
| <HeaderContextMenu EnableTheming="True" Skin="Vista"> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </HeaderContextMenu> |
| <MasterTableView> |
| <NoRecordsTemplate> |
| No Records Found |
| </NoRecordsTemplate> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridBoundColumn HeaderText="Zone Id" UniqueName="Zone_id" DataField="Zone_id" CurrentFilterFunction="NoFilter"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="CS#" UniqueName="Cs_no" DataField="Cs_no"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="Event Id" UniqueName="Event_id" DataField="Event_id" CurrentFilterFunction="NoFilter"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="Event Description" UniqueName="Event_description" DataField="Event_description" CurrentFilterFunction="NoFilter"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="Comment" UniqueName="comment" DataField="comment" CurrentFilterFunction="NoFilter"> |
| </telerik:GridBoundColumn> |
| </Columns> |
| </MasterTableView> |
| <GroupingSettings CaseSensitive="False" /> |
| <FilterMenu EnableTheming="True" Skin="Vista"> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </FilterMenu> |
| </telerik:RadGrid> |
When using the online demo for alpahbetic paging in the Rad Grid, when I click the edit button for the 3rd record on the "P" page the grid opens the edit for the 3rd record on the "A" page.
The stored Procedure is basically the "SELECT * FROM [People] WHERE [Name] LIKE @Letter"
| <asp:SqlDataSource ID="SqlDataSource1" runat="server" |
| ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>" |
| SelectCommand = "GetSeminarSpeakers" SelectCommandType="StoredProcedure"> |
| <SelectParameters> |
| <asp:Parameter Name="Letter" DefaultValue="%" /> |
| </SelectParameters> |
| </asp:SqlDataSource> |
| Protected Sub rgSpeakers_ItemCommand(ByVal source As Object, ByVal e As Telerik.WebControls.GridCommandEventArgs) Handles rgSpeakers.ItemCommand |
| Dim value As String = Nothing |
| Select Case e.CommandName |
| Case ("alpha") |
| value = String.Format("{0}%", e.CommandArgument) |
| Exit Select |
| Case ("nofilter") |
| value = "%" |
| Exit Select |
| End Select |
| Me.SqlDataSource1.SelectParameters("Letter").DefaultValue = value |
| rgSpeakers.Rebind() |
| End Sub |
| Protected Sub rgSpeakers_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles rgSpeakers.ItemCreated |
| If TypeOf e.Item Is GridPagerItem Then |
| Dim pagerItem As GridPagerItem = CType(e.Item, GridPagerItem) |
| pagerItem.PagerContentCell.Controls.Clear() |
| Dim i As Integer |
| For i = 65 To 65 + 25 |
| Dim linkButton1 As New LinkButton |
| Dim lc As New LiteralControl(" ") |
| linkButton1.Text = "" + ChrW(i) |
| linkButton1.CommandName = "alpha" |
| linkButton1.CommandArgument = "" + ChrW(i) |
| pagerItem.PagerContentCell.Controls.Add(linkButton1) |
| pagerItem.PagerContentCell.Controls.Add(lc) |
| Next i |
| Dim lcLast As New LiteralControl(" ") |
| pagerItem.PagerContentCell.Controls.Add(lcLast) |
| Dim linkButtonAll As New LinkButton |
| linkButtonAll.Text = "All" |
| linkButtonAll.CommandName = "NoFilter" |
| pagerItem.PagerContentCell.Controls.Add(linkButtonAll) |
| End If |
| End Sub |
Protected
Sub RadGrid1_ItemInserted(ByVal source As Object, ByVal e As Telerik.Web.UI.GridInsertedEventArgs) Handles RadGrid1.ItemInserted
InitializeUpdateParameter(
DirectCast(e.Item.FindControl("RadUpload1"), RadUpload))
End Sub
Protected Sub RadGrid1_UpdateCommand(ByVal source As Object, ByVal e As GridCommandEventArgs)
InitializeUpdateParameter(
DirectCast(e.Item.FindControl("RadUpload1"), RadUpload))
End Sub
Private Sub InitializeUpdateParameter(ByVal currentUpload As RadUpload)
If currentUpload.UploadedFiles.Count > 0 Then
Dim data As Byte() = New Byte(currentUpload.UploadedFiles(0).ContentLength) {}
currentUpload.UploadedFiles(0).InputStream.Read(data, 0, data.Length)
Session(
"DataVB") = data
End If
End Sub
| <telerik:RadGrid ID="rgAnalysisResults" |
| runat="server" |
| AutoGenerateColumns="False" |
| AllowPaging="True" |
| AllowSorting="True" |
| ShowStatusBar="True" |
| Skin="BDB" EnableEmbeddedSkins="False" GridLines="None" > |
| <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle> |
| <CommandItemStyle /> |
| <MasterTableView> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridBoundColumn DataField="DocumentDate" HeaderText="DocumentDate" |
| UniqueName="DocumentDate" DataFormatString="{0:dd/MM/yyyy}" |
| DataType="System.DateTime" /> |
| <telerik:GridBoundColumn DataField="Parcel" HeaderText="Parcel" UniqueName="Parcel" /> |
| <telerik:GridBoundColumn DataField="LaboNbr" HeaderText="LaboNbr" UniqueName="LaboNbr" /> |
| <%-- <telerik:GridButtonColumn ButtonType="ImageButton" CommandArgument="FileName" ImageUrl="~/images/pdf.gif" |
| DataTextField="" CommandName="ShowPDF" UniqueName="FileName" HeaderText="" />--%> |
| <telerik:Gridtemplatecolumn UniqueName="PDF" HeaderText="Pdf"> |
| <ItemTemplate> |
| <asp:ImageButton ID="DownloadPDFButton" CommandName="Download" runat="server" CommandArgument="FileName" ImageUrl="~/images/pdf.gif" /> |
| </ItemTemplate> |
| </telerik:Gridtemplatecolumn> |
| <%-- <telerik:Gridtemplatecolumn> |
| <ItemTemplate> |
| <asp:ImageButton ID="DownloadXMLButton" CommandName="DownloadXML" runat="server" CommandArgument="FileNameXML" ImageUrl="~/images/xml.gif" /> |
| </ItemTemplate> |
| </telerik:Gridtemplatecolumn>--%> |
| </Columns> |
| <NoRecordsTemplate> |
| <asp:Label ID="lblNoRecords" runat="server" Text="" ForeColor="Red" resourcekey="lblNoRecords" /> |
| </NoRecordsTemplate> |
| <EditFormSettings> |
| <EditColumn InsertImageUrl="Update.gif" UpdateImageUrl="Update.gif" EditImageUrl="Edit.gif" CancelImageUrl="Cancel.gif"></EditColumn> |
| </EditFormSettings> |
| </MasterTableView> |
| <FilterMenu Skin="BDB" EnableEmbeddedSkins="False" EnableTheming="True"> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </FilterMenu> |
| </telerik:RadGrid> |