<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
CssClass
=
"RadGrid"
GridLines
=
"None"
wallowpaging
=
"True"
PageSize
=
"20"
AllowSorting
=
"True"
AutoGenerateColumns
=
"False"
ShowStatusBar
=
"True"
AllowAutomaticDeletes
=
"True"
AllowAutomaticUpdates
=
"True"
DataSourceID
=
"SqlDataSource1"
OnItemDeleted
=
"RadGrid1_ItemDeleted"
OnItemInserted
=
"RadGrid1_ItemInserted"
OnItemUpdated
=
"RadGrid1_ItemUpdated"
OnItemCommand
=
"RadGrid1_ItemCommand"
OnPreRender
=
"RadGrid1_PreRender"
CellSpacing
=
"0"
OnItemCreated
=
"RadGrid1_ItemCreated"
OnItemDataBound
=
"RadGrid1_ItemDataBound"
>
<
PagerStyle
Mode
=
"Slider"
/>
<
ClientSettings
>
<
ClientEvents
OnRowDblClick
=
"RowDblClick"
/>
</
ClientSettings
>
<
AlternatingItemStyle
/>
<
MasterTableView
CommandItemDisplay
=
"Top"
Name
=
"Documents"
AutoGenerateColumns
=
"False"
Width
=
"100%"
DataSourceID
=
"SqlDataSource1"
DataKeyNames
=
"ID"
>
<
DetailTables
>
<
telerik:GridTableView
DataKeyNames
=
"ID"
Name
=
"Sections"
DataSourceID
=
"SqlDataSource2"
runat
=
"server"
>
<%-- Sql DataSource 3 --%>
<
DetailTables
>
<
telerik:GridTableView
DataKeyNames
=
"ID"
Name
=
"Requirements"
DataSourceID
=
"SqlDataSource3"
>
<
ParentTableRelation
>
<
telerik:GridRelationFields
DetailKeyField
=
"DocumentSectionID"
MasterKeyField
=
"ID"
/>
</
ParentTableRelation
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"ID"
HeaderText
=
"ID"
SortExpression
=
"ID"
UniqueName
=
"ID"
Visible
=
"false"
FilterControlAltText
=
"Filter Name column"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"DocNameReqID"
SortExpression
=
"DocNameReqID"
FilterControlAltText
=
"Filter Text column"
HeaderText
=
"ID"
UniqueName
=
"DocNameReqID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Category"
SortExpression
=
"Category"
FilterControlAltText
=
"Filter Text column"
HeaderText
=
"Category"
UniqueName
=
"Category"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Text"
SortExpression
=
"Text"
FilterControlAltText
=
"Filter Text column"
HeaderText
=
"Text"
UniqueName
=
"Text"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Highlight"
HeaderText
=
"Highlight"
SortExpression
=
"Highlight"
UniqueName
=
"Highlight"
Visible
=
"false"
FilterControlAltText
=
"Filter Highlight column"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Keyword"
SortExpression
=
"Keyword"
FilterControlAltText
=
"Filter Text column"
HeaderText
=
"Keyword"
UniqueName
=
"Keyword"
>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
>
<
ItemTemplate
>
<
asp:ImageButton
ID
=
"ibtnEdit"
runat
=
"server"
CommandName
=
"EditRecord"
CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ID") %>'
AlternateText="Edit" ImageUrl="~/Images/edit.gif" />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridButtonColumn
ConfirmText
=
"Delete this record?"
ConfirmDialogType
=
"RadWindow"
ConfirmTitle
=
"Delete"
ButtonType
=
"ImageButton"
CommandName
=
"Delete"
Text
=
"Delete"
UniqueName
=
"ID"
>
<
ItemStyle
HorizontalAlign
=
"Center"
CssClass
=
"MyImageButton"
/>
</
telerik:GridButtonColumn
>
</
Columns
>
</
telerik:GridTableView
>
</
DetailTables
>
<%-- Sql DataSource 3 --%>
<
ParentTableRelation
>
<
telerik:GridRelationFields
DetailKeyField
=
"DocumentID"
MasterKeyField
=
"ID"
/>
</
ParentTableRelation
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"ID"
HeaderText
=
"ID"
SortExpression
=
"ID"
UniqueName
=
"ID"
Visible
=
"false"
FilterControlAltText
=
"Filter Name column"
>
</
telerik:GridBoundColumn
>
<
telerik:GridButtonColumn
DataTextField
=
"Name"
HeaderText
=
"Name"
CommandName
=
"RequirementLink"
ButtonType
=
"LinkButton"
>
</
telerik:GridButtonColumn
>
<
telerik:GridBoundColumn
DataField
=
"Text"
SortExpression
=
"Text"
FilterControlAltText
=
"Filter Text column"
HeaderText
=
"Req Description"
UniqueName
=
"Text"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"PageNo"
SortExpression
=
"PageNo"
FilterControlAltText
=
"Filter Text column"
HeaderText
=
"Page"
UniqueName
=
"Text"
>
</
telerik:GridBoundColumn
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
FilterControlAltText
=
"Filter EditCommandColumn column"
>
</
telerik:GridEditCommandColumn
>
<
telerik:GridButtonColumn
ConfirmText
=
"Delete this record?"
ConfirmDialogType
=
"RadWindow"
ConfirmTitle
=
"Delete"
ButtonType
=
"ImageButton"
CommandName
=
"Delete"
Text
=
"Delete"
UniqueName
=
"ID"
>
<
ItemStyle
HorizontalAlign
=
"Center"
CssClass
=
"MyImageButton"
/>
</
telerik:GridButtonColumn
>
</
Columns
>
<
SortExpressions
>
<
telerik:GridSortExpression
FieldName
=
"ID"
></
telerik:GridSortExpression
>
</
SortExpressions
>
</
telerik:GridTableView
>
</
DetailTables
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"ID"
HeaderText
=
"ID"
SortExpression
=
"ID"
UniqueName
=
"ID"
Visible
=
"true"
FilterControlAltText
=
"Filter Name column"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"FileName"
SortExpression
=
"FileName"
FilterControlAltText
=
"Filter FileName column"
HeaderText
=
"File Name"
UniqueName
=
"FileName"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"DocFormat"
FilterControlAltText
=
"Filter DocFormat column"
HeaderText
=
"Format"
SortExpression
=
"DocFormat"
UniqueName
=
"DocFormat"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Size"
FilterControlAltText
=
"Filter Size column"
HeaderText
=
"Size (KB)"
SortExpression
=
"Size"
UniqueName
=
"Size"
DataType
=
"System.Double"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"TimeStamp"
DataType
=
"System.DateTime"
FilterControlAltText
=
"Filter TimeStamp column"
HeaderText
=
"Time Stamp"
SortExpression
=
"TimeStamp"
UniqueName
=
"TimeStamp"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ParsedTime"
DataType
=
"System.DateTime"
FilterControlAltText
=
"Filter ParsedTime column"
HeaderText
=
"Parsed Time"
SortExpression
=
"ParsedTime"
UniqueName
=
"ParsedTime"
>
</
telerik:GridBoundColumn
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
FilterControlAltText
=
"Filter EditCommandColumn column"
>
</
telerik:GridEditCommandColumn
>
<
telerik:GridButtonColumn
ButtonType
=
"ImageButton"
CommandName
=
"Download"
Text
=
"Download"
ImageUrl
=
"~/Images/download.png"
>
</
telerik:GridButtonColumn
>
<
telerik:GridButtonColumn
ConfirmText
=
"Delete this record?"
ConfirmDialogType
=
"RadWindow"
ConfirmTitle
=
"Delete"
ButtonType
=
"ImageButton"
CommandName
=
"Delete"
Text
=
"Delete"
UniqueName
=
"ID"
>
<
ItemStyle
HorizontalAlign
=
"Center"
CssClass
=
"MyImageButton"
/>
</
telerik:GridButtonColumn
>
</
Columns
>
<
EditFormSettings
UserControlName
=
"EmployeeDetailsCS.ascx"
EditFormType
=
"WebUserControl"
>
<
EditColumn
UniqueName
=
"EditCommandColumn1"
>
</
EditColumn
>
</
EditFormSettings
>
</
MasterTableView
>
<
FilterMenu
EnableImageSprites
=
"False"
>
</
FilterMenu
>
<
HeaderContextMenu
CssClass
=
"GridContextMenu GridContextMenu_WebBlue"
>
</
HeaderContextMenu
>
</
telerik:RadGrid
>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:DocumentParsingConnectionString %>"
SelectCommand="SELECT [ID],[Name], [FileName], [DocType], [DocFormat], [DocRefNo], [Title], [Size], [Version], [TimeStamp],[ParsedTime] FROM [Documents]"
UpdateCommand="UPDATE [Documents] SET [Name] = @Name WHERE [ID]=@ID" DeleteCommand="DELETE FROM [Documents] WHERE [ID] = @ID"
OldValuesParameterFormatString="original_{0}" ConflictDetection="OverwriteChanges">
<
UpdateParameters
>
<
asp:Parameter
Name
=
"Name"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_ID"
Type
=
"Int64"
/>
<
asp:Parameter
Name
=
"original_Name"
Type
=
"String"
/>
</
UpdateParameters
>
<
DeleteParameters
>
<
asp:Parameter
Name
=
"ID"
Type
=
"Int64"
/>
</
DeleteParameters
>
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"SqlDataSource2"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:DocumentParsingConnectionString %>"
SelectCommand="SELECT [ID],[PageNo],[Name],SUBSTRING ([Text], 0 , 255 ) AS [Text] FROM [DocumentSections] WHERE DocumentID=@DocumentID"
DeleteCommand="DELETE FROM [DocumentSections] WHERE [ID] = @ID">
<
SelectParameters
>
<
asp:SessionParameter
SessionField
=
"DocumentID"
Name
=
"DocumentID"
Type
=
"Int64"
/>
</
SelectParameters
>
<
DeleteParameters
>
<
asp:Parameter
Name
=
"ID"
Type
=
"Int64"
/>
</
DeleteParameters
>
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"SqlDataSource3"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:DocumentParsingConnectionString %>"
SelectCommand="SELECT [DocumentSections].[Name] + CONVERT(varchar(250), ROW_NUMBER() OVER (ORDER BY [Requirements].[ID])) AS DocNameReqID, [DocumentSections].[DocumentID] AS [DocumentID], [DocumentSections].[Name] AS [DocumentSectionName], [Requirements].[ID],[Requirements].[Category],[Requirements].[Text], [Requirements].[Keyword], [Requirements].[Highlight] FROM [Requirements] INNER JOIN [DocumentSections] ON [Requirements].[DocumentSectionID] = [DocumentSections].[ID] WHERE [Requirements].[DocumentSectionID]=@DocumentSectionID"
DeleteCommand="DELETE FROM [Requirements] WHERE [ID] = @ID">
<
SelectParameters
>
<
asp:SessionParameter
SessionField
=
"DocumentSectionID"
Name
=
"DocumentSectionID"
Type
=
"Int64"
/>
</
SelectParameters
>
<
DeleteParameters
>
<
asp:Parameter
Name
=
"ID"
Type
=
"Int64"
/>
</
DeleteParameters
>
</
asp:SqlDataSource
>
<
table
id
=
"Table3"
cellspacing
=
"1"
cellpadding
=
"1"
width
=
"100%"
border
=
"0"
>
<
tr
>
<
td
>
</
td
>
<
td
>
</
td
>
</
tr
>
<
tr
>
<
td
>
Name:
</
td
>
<
td
>
<
asp:HiddenField
ID
=
"hfID"
runat
=
"server"
Value='<%# DataBinder.Eval( Container, "DataItem.Name" ) %>'></
asp:HiddenField
>
<
asp:TextBox
ID
=
"TextBox7"
runat
=
"server"
Text='<%# DataBinder.Eval( Container, "DataItem.Name" ) %>'>
</
asp:TextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
>
FileName:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox8"
runat
=
"server"
Text='<%# DataBinder.Eval( Container, "DataItem.FileName") %>'
TabIndex="1">
</
asp:TextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
>
DocType:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox9"
runat
=
"server"
Text='<%# DataBinder.Eval( Container, "DataItem.DocType") %>'
TabIndex="2">
</
asp:TextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
>
DocFormat:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox5"
runat
=
"server"
Text='<%# DataBinder.Eval( Container, "DataItem.DocFormat") %>'
TabIndex="2">
</
asp:TextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
>
DocRefNo:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox10"
runat
=
"server"
Text='<%# DataBinder.Eval( Container, "DataItem.DocRefNo") %>'
TabIndex="2">
</
asp:TextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
align
=
"right"
colspan
=
"2"
>
<
asp:Button
ID
=
"btnUpdate"
Text
=
"Update"
runat
=
"server"
CommandName
=
"Update"
Visible='<%# !(DataItem is Telerik.Web.UI.GridInsertionObject) %>'
onclick="btnUpdate_Click">
</
asp:Button
>
<
asp:Button
ID
=
"btnInsert"
Text
=
"Insert"
runat
=
"server"
CommandName
=
"PerformInsert"
Visible='<%# DataItem is Telerik.Web.UI.GridInsertionObject %>'></
asp:Button
>
<
asp:Button
ID
=
"btnCancel"
Text
=
"Cancel"
runat
=
"server"
CausesValidation
=
"False"
CommandName
=
"Cancel"
></
asp:Button
>
</
td
>
</
tr
>
</
table
>
Hello!
I have inherited an asp.net project that relies heavily on the Telerik library. In the current application, there are two menu items that when clicked generate a redirect to the same asp page, but with different arguments:
~\myasppage.aspx?Mode="A"&Type="B";
~\myasppage.aspx?Mode="C"&Type="D";
So I have been asked to replace them with a dialog box that allows the user to choose the Mode and type, then opening the page. In looking at the Telerik controls that are available to me, it seems that the RadWindow is perfect. My strategy is:
redirect to the generic page:
~\myasppage.aspx
Define a RadWindow on the page and sets its VisibleOnPageLoad to true.
The RadWindows contains a Cancel button and a Next button. Selection of the cancel button closes the dialog and leaves an empty page. Selection of the Next button will redirect to the same page but contain the Mode and Type parameters using the
window.location = myasppage.aspx?Mode="whatever"&Type="whatever";
My problem is that because VisibleOnPageLoad=true the radwindow always opens so I can't load the real page!
Am I going about this correctly? Is there another control to deal with this?
I was thinking that I could set VisibleOnPageLoad to false, then check for my parameters in the OnPreInit method to decide if I should show the radwindow.
I haven't been able to figure out how to call a javascript function (to show the radwindow) from the code behind, and even if I could, I'm not sure that the javascript would even be loaded yet!
Is there a better way of doing this? Will this even work?
thanks
s =
string
.Empty;
s +=
"function "
+
this
.ClientID +
"_defaultEnter(sender, eventArgs) { \r\n"
;
s +=
" var c = eventArgs.get_keyCode(); \r\n"
;
s +=
" var btn = document.getElementById('"
+ btnSearch.ClientID +
"'); \r\n"
;
s +=
" if (c == 13){ \r\n"
;
s +=
" btn.click(); \r\n"
;
s +=
" eventArgs.set_cancel(true); \r\n"
;
s +=
" } \r\n"
;
s +=
"}\r\n"
;
this
.Page.ClientScript.RegisterClientScriptBlock(
this
.GetType(),
this
.ClientID +
"_defaultEnter"
, s,
true
);
fldCaseNumber.ClientEvents.OnKeyPress =
this
.ClientID +
"_defaultEnter"
;