<
telerik:RadGrid
ID
=
"rgUsers"
AutoGenerateColumns
=
"false"
runat
=
"server"
OnNeedDataSource
=
"OnNeedDataSource"
>
<
ClientSettings
>
<
ClientEvents
OnRowDblClick
=
"RowDblClick"
/>
</
ClientSettings
>
<
MasterTableView
TableLayout
=
"Fixed"
CommandItemDisplay
=
"Top"
EditMode
=
"InPlace"
InsertItemDisplay
=
"Bottom"
AutoGenerateColumns
=
"false"
>
<
CommandItemTemplate
>
<
asp:LinkButton
ID
=
"btnAddNew"
runat
=
"server"
CommandName
=
"InitInsert"
Text
=
"New"
Visible='<%# rgUsers.EditIndexes.Count == 0 && !rgUsers.MasterTableView.IsItemInserted %>' />
<
asp:Button
ID
=
"btnInsert"
runat
=
"server"
CommandName
=
"PerformInsert"
Text
=
"Insert"
/>
<
asp:Button
ID
=
"btnEditSelected"
runat
=
"server"
CommandName
=
"EditSelected"
Text
=
"Edit"
/>
</
CommandItemTemplate
>
<
Columns
>
<
telerik:GridTemplateColumn
HeaderText
=
"UserName"
UniqueName
=
"UserName"
SortExpression
=
"UserName"
ItemStyle-HorizontalAlign
=
"Left"
HeaderStyle-HorizontalAlign
=
"Center"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblUsername"
runat
=
"server"
Text='<%#Eval("UserName")%>' />
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadTextBox
ID
=
"txtUsername"
runat
=
"server"
Text='<%#Eval("UserName")%>'>
</
telerik:RadTextBox
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
dt.Columns.Add("chk")
dt.Columns.Add("Profile Image")
dt.Columns.Add("Name")
dt.Columns.Add("Info1")
dt.Columns.Add("Info2")
dt.Columns.Add("Score")
dt.Columns.Add("Actions")
dt.Rows.Add(CheckBox, Image, "#Name#", "#Info#", "#Info2#", "#Score#", "##Actions##")
RadGrid1.DataSource = dt
RadGrid1.Rebind()
I have a need to use a RadWindow from a HyperLink in both the level 1 columns and the DetailTables.
The RadGrid data is populated via OnNeedDataSource() as the data is extracted from a context.
The DetailTables data is populated via OnDetailTableDataBind().
When I used an OnItemCreated() to enable me to change the href and onclick attributes of the asp:HyperLinks, I lost the data in the RadGrid and was not able to select anything. I realize it is because the data has been changed so this option is not available to me, though the RadWindow was working nicely.
Currently I am using GridHyperLinkColumns but am unable to use a RadWindow with these.
Any suggestions of how to make it work?
The text in design tab for the radeditor shows single space but in HTML tab there are two spaces. I'm assuming the radeditor is compensating for this in the design tab? Is there anything we can do about it? Our users don't realize there is an extra space that shouldn't be there because they don't see it.
For example, the text "administration to the bloodstream" does not appear to have extra spaces between 'administration' and 'to' when viewed in the design tab, bit when viewed in the html tab it appears as like this... "administration to the bloodstream"
ThanksHi,
I have a RadGrid with a CommandItemTemplate.In the InstantiateIn I define a toolbar and add two buttons.
After clicking the button I do a Rebind of the grid in the ItemCommand-event of the grid and I change the text of the clicked button. This fires also the InstantiateIn event of the CommandItemTemplate, so the text of the button is reset.
If I store the text in a property and want to acces this one I get the error:
Cannot access non-static field in static context
I have a kind of sollution with going to the parent of the container like ( container.Parent.Parent.Parent ect) to approach the property. But is there a better approach to change the text of the buttons after clicking them. And I cannot do this client side.
regards, Richard
Hi,
Please let me know can I use Talarik's control to edit MS Word file online? The one I tried with online demo at: https://demos.telerik.com/aspnet-ajax/editor/examples/ms-word-like-experience/defaultcs.aspx disturbed the format of MS Word file and also remove the forms fields.
I want my users to edit MS Word file containing Form Fields and save them back. Is it possible with Telerik in Asp.Net ?
Hi,
I have search everywhere.
Documentation( Really poor documentation on Pivot ) , Knowledge Base ( Last post 2015, the second last 2012 ) , Forum well ..
Is it possible to add a "Real link" in the cell of a PivotGrid.
By real , I mean base on data that are in the result set but are not diplayed. Things like id, number that are never displayed to Customer.
I would like to show some more information based on fields that are in the result set but are not diplayed.
Its to mutch information for a little tooltips.
I need to create a link with "~/Somewhere/MyDetailPage.aspx?P=HiddenRowField&Filter=ColumnField"
As its seems to be impossible to get multiple field value into a cell template.
If I add a button in the cell template. Will I be able to retrieve Row/Column Field Value Of the clicked Button ?
I have a grid control with a GridTemplateColumn that contains an ItemTemplate and an InsertItemTemplate. The InsertItemTemplate contains a dropdown list. The problem is that I get a null reference exception when I try to insert a new record. I know that the issue lies in the code behind where I am using the following line:
new_doc_stat_cmd.Parameters.AddWithValue(
"@docStat"
, rg_doc_stats.MasterTableView.FindControl(
"docStatDdlInsert"
));
When I replace the above line with the one below, the insert command is executed successfully:
new_doc_stat_cmd.Parameters.AddWithValue(
"@docStat"
, 4);
Here is the code for the grid:
<
telerik:RadGrid
ID
=
"rg_doc_stats"
runat
=
"server"
DataSourceID
=
"sdc_doc_stats"
AllowSorting
=
"True"
Skin
=
"Office2010Blue"
CellSpacing
=
"-1"
GridLines
=
"Both"
OnInsertCommand
=
"rg_doc_stats_InsertCommand"
>
<
ClientSettings
AllowColumnsReorder
=
"True"
ReorderColumnsOnClient
=
"True"
></
ClientSettings
>
<
MasterTableView
DataSourceID
=
"sdc_doc_stats"
AutoGenerateColumns
=
"False"
DataKeyNames
=
"docStatIdPk"
CommandItemDisplay
=
"Top"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"docStatIdPk"
ReadOnly
=
"True"
HeaderText
=
"docStatIdPk"
SortExpression
=
"docStatIdPk"
UniqueName
=
"docStatIdPk"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter docStatIdPk column"
></
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
DataField
=
"docStat"
HeaderText
=
"Status"
SortExpression
=
"docStat"
UniqueName
=
"docStat"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter docStat column"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
Text='<%# Bind("stat") %>' ID="statLbl"></
asp:Label
>
</
ItemTemplate
>
<
InsertItemTemplate
>
<
asp:DropDownList
ID
=
"docStatDdlInsert"
runat
=
"server"
SelectedValue='<%# Bind("docStat") %>' DataSourceID="sdc_stats" DataTextField="stat" DataValueField="statIdPk" AppendDataBoundItems="true"><
asp:ListItem
Value
=
""
>--Please Select--</
asp:ListItem
></
asp:DropDownList
>
</
InsertItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
DataField
=
"docStatDt"
HeaderText
=
"Status Date"
SortExpression
=
"docStatDt"
UniqueName
=
"docStatDt"
FilterControlAltText
=
"Filter docStatDt column"
DataType
=
"System.DateTime"
ReadOnly
=
"true"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"docStatSetBy"
HeaderText
=
"Status Set By"
SortExpression
=
"docStatSetBy"
UniqueName
=
"docStatSetBy"
FilterControlAltText
=
"Filter docStatSetBy column"
ReadOnly
=
"true"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"docIdFk"
HeaderText
=
"docIdFk"
SortExpression
=
"docIdFk"
UniqueName
=
"docIdFk"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter docIdFk column"
ReadOnly
=
"true"
></
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
</
telerik:RadPageView
>
Here are the InsertParameters from the SqlDataSource:
<
InsertParameters
>
<
asp:Parameter
Name
=
"docStat"
Type
=
"Int32"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"docStatDt"
Type
=
"DateTime"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"docStatSetBy"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"docIdFk"
Type
=
"Int32"
></
asp:Parameter
>
</
InsertParameters
>
Here is the InsertCommand from the SqlDataSource:
InsertCommand=
"INSERT INTO [docStats] ([docStat], [docStatDt], [docStatSetBy], [docIdFk]) VALUES (@docStat, @docStatDt, @docStatSetBy, @docIdFk)"
Here is the InsertCommand from the code behind:
protected
void
rg_doc_stats_InsertCommand(
object
sender, GridCommandEventArgs e)
{
SqlConnection drap_cnxn =
new
SqlConnection(
"Server=Mine\\SQLEXPRESS;Initial Catalog=drap;Integrated Security=True;"
);
{
SqlCommand new_doc_stat_cmd =
new
SqlCommand(
"Insert Into docStats(docStat, docStatDt, docStatSetBy, docIdFk) Values(LTRIM(RTRIM(@docStat)), LTRIM(RTRIM(@docStatDt)), LTRIM(RTRIM(@docStatSetBy)), LTRIM(RTRIM(@docIdFk)))"
, drap_cnxn);
new_doc_stat_cmd.Parameters.AddWithValue(
"@docStat"
, rg_doc_stats.MasterTableView.FindControl(
"docStatDdlInsert"
));
new_doc_stat_cmd.Parameters.AddWithValue(
"@docStatDt"
, DateTime.Now.ToString());
new_doc_stat_cmd.Parameters.AddWithValue(
"@docStatSetBy"
, HttpContext.Current.User.Identity.Name);
new_doc_stat_cmd.Parameters.AddWithValue(
"@docIdFk"
, hdn_doc_id.Value);
drap_cnxn.Open();
new_doc_stat_cmd.ExecuteNonQuery();
drap_cnxn.Close();
if
(IsPostBack)
{
rg_ven_docs.DataBind();
rg_doc_stats.DataBind();
}
}
}
Thank you,
J