GridRowDrop
) does not fire and the Page appears to do a PostBack. I believe this has to do with something with AJAX settings, but not certain.Dim
SectionGrid
As
New
RadGrid()
With
SectionGrid
.DataSource = GetData(FCTN_TYPE_CD, CALLING_AGENT)
With
.MasterTableView
.NoMasterRecordsText =
"No associates assigned"
.Columns.Add(
New
GridDragDropColumn)
End
With
.Rebind()
End
With
' Set each grid's properties.
With
SectionGrid
.ID =
"SectionGrid_"
& FCTN_TYPE_CD
.AllowSorting =
True
.Width = Unit.Percentage(99)
.AutoGenerateColumns =
False
.ShowHeader =
False
.AllowMultiRowSelection =
True
.CssClass =
"BottomCorners"
.Attributes.Add(
"style"
,
"border:none;"
)
With
.ClientSettings
.AllowRowsDragDrop =
True
.Selecting.EnableDragToSelectRows =
False
.Selecting.AllowRowSelect =
True
.ClientEvents.OnRowDropping =
"onRowDropping"
.EnablePostBackOnRowClick =
False
End
With
End
With
With
SectionGrid.MasterTableView
.Width = Unit.Percentage(100)
.DataKeyNames =
New
String
() {
"LDAP"
}
.GetColumn(
"LDAP"
).Visible =
False
End
With
AssignedGrid.Controls.Add(SectionGrid)
With
PanelItem
.Items.Add(AssignedGrid)
.Expanded =
True
End
With
If
SectionGrid.Items.Count = 0
Then
PanelItem.Expanded =
False
AddHandler
SectionGrid.RowDrop,
AddressOf
GridRowDrop
AddHandler
SectionGrid.NeedDataSource,
AddressOf
GridNeedDataSource
In the popup that opens when I insert or edit one item in the grid, some logic has to be done, for example: enable and disable fields, depending on the values of other fields.
How can I add an onload event for the popup so that I can run js code to perform those enable/disable?
I already tried the OnPopUpShowing event, but it doesn’t work with date pickers, it fails in the get_selectedDate() because the _dateInput is empty (return this._dateInput.get_selectedDate())
Here’s the grid and javascript (simplified):
<RadGrid runat="server" ID="Grid1" AllowPaging="True" GridLines="None" CellSpacing="0" Culture="English (United Kingdom)" AllowSorting="True" AutoGenerateDeleteColumn="True" Width="95%" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" DataSourceID="ControlPanelNotifications_DS">
<MasterTableView DataKeyNames="fldId" DataSourceID="ControlPanelNotifications_DS" EditMode="PopUp" AutoGenerateColumns="False">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
<Columns>
…
<ItemStyle HorizontalAlign="Center" Width="40px"></ItemStyle>
</sqr:GridButtonColumn>
</Columns>
<EditFormSettings CaptionFormatString="Detalhes" EditFormType="Template">
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
<FormTemplate>
<table style="width: 100%;">
<tr>
<td>
label
<td>
text
<td>
Label2
<td>
<RadDatePicker runat="server" ID="dtPracticalDate" Width="100px">
<ClientEvents OnDateSelected="dtPracticalDate_DateSelected" />
</RadDatePicker >
<BindableControl runat="server" DataField="PraticalDate" TargetControlID="dtPracticalDate"></BindableControl> </td>
</tr>
<tr>
<td>
Label3
<td>
text
</td>
<td>
Label4
<td>
<RadDatePicker runat="server" ID="dtConfirmationDate" Width="100px">
<ClientEvents OnDateSelected="dtConfirmationDate_DateSelected" />
</RadDatePicker >
<BindableControl runat="server" DataField="ConfirmationDate" TargetControlID="dtConfirmationDate"></BindableControl> </td>
</tr>
</table>
<asp:Button runat="server" CommandName="Cancel" Text="Cancelar"></asp:Button>
</FormTemplate>
<PopUpSettings Modal="True" Width="570px"></PopUpSettings>
</EditFormSettings>
</MasterTableView>
<FilterMenu EnableImageSprites="False"></FilterMenu>
<ClientSettings>
<ClientEvents OnPopUpShowing="PopUpShowing"></ClientEvents>
</ClientSettings>
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
</RadGrid>
Javascript:
function PopUpShowing(sender, eventArgs) {
var practicalDate = getElementById('dtPracticalDate').get_selectedDate();
UpdateConfirmationDate22(practicalDate);
}
function UpdateConfirmationDate22(practicalDate) {
var confirmationDatePicker = getElementById('dtConfirmationDate');
if (practicalDate != null) {
confirmationDatePicker.set_enabled(true);
}
else {
confirmationDatePicker.set_enabled(false);
confirmationDatePicker.clear();
}
}
Hello,
I'm using Telerik's RadAjaxManager to update panels independently.
On my page, I have 3 user controls: A, B, C.
My AjaxSettings are:
If I do a postback on A, I see the loading panel on A, but (using Chrome dev tool) I see data sent for A and B. Strange to me as only A has loading panel.
If I do as postback on B, same behavior: loading panel on B but data for A and B.
Now, if I remove from AjaxSettings the settings for B, when I do a postback on A, only data for A are sent.
Am I wrong, or I should only see data for the "target" panel defined in AjaxSettings?
Moreover, sometimes in our user controls we access the RadAjaxManager to add response script. Can it be related? For instance, if in B's code-behind I add script to RadAjaxManager, will the entire B content will be sent when I do a postback on A (with rule A updates A only)?
This is really an issue in our app.
Thanks in advance for any help.
<
p
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid2"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid2"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
/>
<
telerik:RadGrid
ID
=
"RadGrid1"
Width
=
"100%"
DataSourceID
=
"SqlDataSource1"
AllowFilteringByColumn
=
"True"
AllowSorting
=
"True"
AllowPaging
=
"True"
PageSize
=
"7"
runat
=
"server"
AutoGenerateColumns
=
"False"
OnPreRender
=
"RadGrid1_PreRender"
ShowStatusBar
=
"true"
EnableLinqExpressions
=
"false"
>
<
MasterTableView
DataKeyNames
=
"IdEmpresa"
>
<
Columns
>
<
telerik:GridBoundColumn
UniqueName
=
"Empresa"
DataField
=
"Empresa"
HeaderText
=
"Empresa"
AllowFiltering
=
"false"
HeaderStyle-Width
=
"200px"
/>
<
telerik:GridBoundColumn
UniqueName
=
"Supergrupo"
DataField
=
"Supergrupo"
HeaderText
=
"Super Grupo"
HeaderStyle-Width
=
"200px"
>
<
FilterTemplate
>
<
telerik:RadComboBox
ID
=
"RadComboBoxTitle"
DataSourceID
=
"SqlDataSource2"
DataTextField
=
"SuperGrupo"
AutoPostBack
=
"false"
DataValueField
=
"SuperGrupo"
Height
=
"200px"
AppendDataBoundItems
=
"true"
SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("SuperGrupo").CurrentFilterValue %>'
runat="server" OnClientSelectedIndexChanged="TitleIndexChanged">
<
Items
>
<
telerik:RadComboBoxItem
Text
=
"Todos"
/>
</
Items
>
</
telerik:RadComboBox
>
<
telerik:RadScriptBlock
ID
=
"RadScriptBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function TitleIndexChanged(sender, args)
{
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
tableView.filter("SuperGrupo", args.get_item().get_value(), "EqualTo");
}
</
script
>
</
telerik:RadScriptBlock
>
</
FilterTemplate
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"Grupo"
DataField
=
"Grupo"
HeaderText
=
"Grupo"
HeaderStyle-Width
=
"200px"
>
<
FilterTemplate
>
<
telerik:RadComboBox
ID
=
"RadComboBoxCity"
DataSourceID
=
"SqlDataSource3"
DataTextField
=
"Grupo"
AutoPostBack
=
"false"
DataValueField
=
"Grupo"
Height
=
"100px"
AppendDataBoundItems
=
"true"
SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("Grupo").CurrentFilterValue %>'
runat="server" OnClientSelectedIndexChanged="CityIndexChanged">
<
Items
>
<
telerik:RadComboBoxItem
Text
=
"All"
/>
</
Items
>
</
telerik:RadComboBox
>
<
telerik:RadScriptBlock
ID
=
"RadScriptBlock2"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function CityIndexChanged(sender, args)
{
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
tableView.filter("Grupo", args.get_item().get_value(), "EqualTo");
}
</
script
>
</
telerik:RadScriptBlock
>
</
FilterTemplate
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
br
/>
<
telerik:RadToolTip
ID
=
"RadToolTip1"
runat
=
"server"
OffsetY
=
"3"
Position
=
"TopCenter"
ShowCallout
=
"false"
Height
=
"20px"
ShowEvent
=
"fromcode"
/>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
ConnectionString="<%$ ConnectionStrings:BTIMEXICO_DESConnectionC %>"
ProviderName="System.Data.SqlClient" runat="server"
SelectCommand="SELECT E.idEmpresa, E.Nombre AS Empresa, GE.idgrupo, G.Descripcion AS Grupo, SG.Descripcion AS SuperGrupo
FROM tbl_empresa E
LEFT JOIN tbl_grupoempresa GE
ON E.idEmpresa = GE.idEmpresa
LEFT JOIN tbl_grupos G
ON GE.idgrupo = G.idgrupo
LEFT JOIN tbl_Supergrupo SG
ON SG.idsupergrupo = G.idsupergrupo
ORDER BY Nombre">
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"SqlDataSource2"
ConnectionString="<%$ ConnectionStrings:BTIMEXICO_DESConnectionC %>"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT DISTINCT Descripcion AS SuperGrupo FROM tbl_supergrupo"
runat="server">
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"SqlDataSource3"
ConnectionString="<%$ ConnectionStrings:BTIMEXICO_DESConnectionC %>"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT DISTINCT Descripcion AS Grupo FROM tbl_grupos"
runat="server">
</
asp:SqlDataSource
>
</
p
>
And the Code-behind
using
System;
using
System.Linq;
using
System.Data;
using
Telerik.Web.UI;
namespace
BCD.PP.VIEW
{
public
partial
class
Client_Question_Config_A : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
}
}
protected
void
ImportedFilter_ItemDataBound(
object
sender, RadComboBoxItemEventArgs e)
{
DataRowView rowView = (DataRowView)e.Item.DataItem;
if
(rowView[
"Bool"
]
is
DBNull)
{
e.Item.Text =
"No"
;
e.Item.Value =
"0"
;
}
else
if
((
bool
)rowView[
"Bool"
])
{
e.Item.Text =
"Yes"
;
e.Item.Value =
"1"
;
}
}
protected
void
RadGrid1_PreRender(
object
sender, System.EventArgs e)
{
if
(RadGrid1.MasterTableView.FilterExpression !=
string
.Empty)
{
RefreshCombos();
}
}
protected
void
RefreshCombos()
{
SqlDataSource2.SelectCommand = SqlDataSource2.SelectCommand +
" WHERE "
+ RadGrid1.MasterTableView.FilterExpression.ToString();
SqlDataSource3.SelectCommand = SqlDataSource3.SelectCommand +
" WHERE "
+ RadGrid1.MasterTableView.FilterExpression.ToString();
RadGrid1.MasterTableView.Rebind();
//<<< Here is where the exception pops up
}
}
}