There is code in this pages base page that recurses the heirarchy of controls on the page at render time and makes "editable" controls non-visible and inserts label controls if the page is supposed to be readonly. The problem I'm seeing is that when the code gets to the GridTableCell control for the grid cell where the RadNumericTextBox should be, the GridTableCell.Controls collection is empty. I was expecting to have access to the RadNumericTextBox control instance at that point.
Should it work the way I am expecting it to, or is there a better way?
Thanks for any help you can give,
Andrew
<
telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" />
to enable gridview for supporting selection and unselection and I want to let user select departmen from left and peoples from right and when user clicked relation button. people-departmen relationship will be build. But I dont know how to know which gridview rows are checked and how to get person ids of selected rows. Could you help me? thank you in advance
Hi,
I am using Custom paging with ObjectDataSource control and I am getting this error:
'ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'GetGLCount' that has parameters: startRowIndex, maximumRows. '
Can somebody help to identify where is the problem?
Thanks!
This my code:
[ASPX page]
<%
@ Page Language="vb" AutoEventWireup="false" CodeBehind="UsingObjectDataSource.aspx.vb" Inherits="TelerikTestingMillionRecords.UsingObjectDataSource" %>
<%
@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" 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>Untitled Page</title>
</
head>
<
body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadGrid ID="RadGrid1" runat="server" Width="95%" Skin="Hay"
DataSourceID="ObjectDataSource1"
ShowGroupPanel="True"
ShowStatusBar="True"
AllowPaging="True"
AllowSorting="True" GridLines="None">
<ClientSettings AllowDragToGroup="true" />
<HeaderContextMenu Skin="Hay">
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</HeaderContextMenu>
<PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
<MasterTableView OverrideDataSourceControlSorting="true" />
<FilterMenu Skin="Hay">
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</FilterMenu>
</telerik:RadGrid>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
EnablePaging="True"
SelectCountMethod="GetGLCount"
SelectMethod="GetGLSubSet"
OldValuesParameterFormatString="original_{0}"
TypeName="TelerikTestingMillionRecords.SQLDataManager">
<SelectParameters>
<asp:Parameter DefaultValue="1" Name="startRowIndex" Type="Int32" />
<asp:Parameter DefaultValue="15" Name="maximumRows" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
</div>
</form>
</
body>
</
html>
[Code Behind]
Imports
System.Data.SqlClient
Imports
Telerik.Web.UI
Imports
TelerikTestingMillionRecords.SQLDataManager
Partial
Public Class UsingObjectDataSource
Inherits System.Web.UI.Page
Private Sub ObjectDataSource1_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceSelectingEventArgs) Handles ObjectDataSource1.Selecting
e.InputParameters(
"startRowIndex") = 1
e.InputParameters(
"maximumRows") = 15
End Sub
[DAL]
Imports
System.Data.SqlClient
Public
Class SQLDataManager
Public Sub New()
End Sub
Shared Function GetGLSubSet(ByVal startRowIndex As Integer, ByVal maximumRows As Integer) As Data.DataSet
' Data adapter to retrieve data from SQL Server based on the page size of the grid.
' The Select statement uses the maximumRows and startRowIndex parameters provided
' by WebGrid to query for data between the start row index for the page up to the page size.
Dim ConnString As String = ConfigurationManager.ConnectionStrings("PCRSQL2005ConnectionString").ConnectionString
'Create a connection to the SQL Server.
Dim conn As SqlConnection = New SqlConnection(ConnString)
conn.Open()
Dim MyDataAdapter As SqlDataAdapter
'Create a DataAdapter, and then provide the name of the stored procedure.
MyDataAdapter =
New SqlDataAdapter("GetPCRGLIFP100Subset", conn)
'Set the command type as StoredProcedure.
MyDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
'Create and add a parameter to Parameters collection for the stored procedure.
MyDataAdapter.SelectCommand.Parameters.Add(
New SqlParameter("@startRowIndex", SqlDbType.Int))
MyDataAdapter.SelectCommand.Parameters.Add(
New SqlParameter("@maximumRows", SqlDbType.Int))
'Assign the search value to the parameter.
MyDataAdapter.SelectCommand.Parameters(
"@startRowIndex").Value = startRowIndex
MyDataAdapter.SelectCommand.Parameters(
"@maximumRows").Value = maximumRows
Dim ds As New DataSet
MyDataAdapter.Fill(ds)
MyDataAdapter.Dispose()
conn.Close()
Return ds
End Function
Public Shared Function GetGLCount() As Integer
' Data adapter to retrieve data from SQL Server based on the page size of the grid.
' The Select statement uses the maximumRows and startRowIndex parameters provided
' by WebGrid to query for data between the start row index for the page up to the page size.
Dim ConnString As String = ConfigurationManager.ConnectionStrings("PCRSQL2005ConnectionString").ConnectionString
'Create a connection to the SQL Server.
Dim conn As SqlConnection = New SqlConnection(ConnString)
conn.Open()
Dim MyDataAdapter As SqlDataAdapter
'Create a DataAdapter, and then provide the name of the stored procedure.
MyDataAdapter =
New SqlDataAdapter("GetPCRGLIFP100RowCount", conn)
'Set the command type as StoredProcedure.
MyDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
'Create and add a parameter to Parameters collection for the stored procedure.
MyDataAdapter.SelectCommand.Parameters.Add(
New SqlParameter("@MaximumRows", SqlDbType.Int))
'Create and add an output parameter to Parameters collection.
'Set the direction for the parameter. This parameter returns the Rows returned.
MyDataAdapter.SelectCommand.Parameters(
"@MaximumRows").Direction = ParameterDirection.Output
Dim ds As New DataSet
MyDataAdapter.Fill(ds)
'Get the number of rows returned, and then assign it to the Label control.
'lblRowCount.Text = DS.Tables(0).Rows.Count().ToString() & " Rows Found!"
GetGLCount = MyDataAdapter.SelectCommand.Parameters(0).Value
MyDataAdapter.Dispose()
conn.Close()
End Function
End
Class
<
ExportSettings IgnorePaging="true" OpenInNewWindow="true" ExportOnlyData="false">
<Pdf AllowAdd="false" AllowCopy="true" AllowModify="true" AllowPrinting="true" Author="Anonymous"
Keywords="None" PageBottomMargin="1in" PageLeftMargin="1in" PageRightMargin="1in"
PageTopMargin="1in" PageTitle="Grid export document" Subject="Grid Export" Title="Grid export"
PaperSize="Letter" />
</ExportSettings>
protected
void RadGridContact_ItemCommand(object source, GridCommandEventArgs e)
{
if
(e.CommandName == "Export")
{
RadGridContact.MasterTableView.ExportToPdf();
}
}
| if (String.IsNullOrEmpty(linkButton.Text)) |
| { |
| base.RenderContents(writer); |
| } |
| else |
| { |
| writer.WriteBeginTag("a"); |
| writer.WriteAttribute("id", linkButton.ClientID); |
| writer.WriteAttribute("title", linkButton.ToolTip); |
| writer.WriteAttribute("class", className); |
| writer.WriteAttribute("href", Page.ClientScript.GetPostBackClientHyperlink(linkButton, "")); |
| writer.Write(HtmlTextWriter.TagRightChar); |
| writer.WriteBeginTag("span"); |
| writer.WriteAttribute("class", "AspNet-LinkButton-Text"); |
| writer.Write(HtmlTextWriter.TagRightChar); |
| writer.Write(linkButton.Text); |
| writer.WriteEndTag("span"); |
| writer.WriteEndTag("a"); Page.ClientScript.RegisterForEventValidation(linkButton.UniqueID); |
| } |