ClientScript.RegisterStartupScript(Page.GetType(), "registerkey", "CloseAndRebind('Registration');", true);
function CloseAndRebind(args) {
GetRadWindow().BrowserWindow.refreshGrid(args);
GetRadWindow().close();
}
function refreshGrid(arg) {
if (!arg) {
var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
ajaxManager.ajaxRequest();
}
else {
var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
ajaxManager.ajaxRequest(arg);
}
}
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
RadGrid1.Rebind();
RadGrid2.Rebind();
RadGrid3.Rebind();
}
tab2 (with 2 grids) has radajaxmanagerproxy and the tab works well. tab3 with radgrid3 works ok when updated by tab1 grid1 but not when updated from the radwindow. i have tried radajaxmanagerproxy on tab 3 grid 3 with no success with and without a radajaxpanel.
i have never been able to debug into the ajaxrequest - not sure if it is possible. i have configured radajaxmanagerproxy through its editor but it does not see the radajaxmanager.
any ideas about why tab3 will not rebind?
i don't need to update all of these grids each time but for now i am using this bloated code until i can get tab 3 to update properly...
I would really appreciate assistance with this one I'm have an issue to dynamically updating the dropdown in the FormTemplate. I need to wire up the events and retrieve the values.
Thanks in advance.
<
telerik:RadGrid ID="radgvLocation" runat="server" CssClass="RadGrid" GridLines="None"
AllowPaging="True" PageSize="15" AllowSorting="True" AutoGenerateColumns="False"
ShowStatusBar="true" AllowAutomaticDeletes="false" AllowAutomaticInserts="false"
AllowAutomaticUpdates="false" HorizontalAlign="NotSet" Skin="Vista" OnInsertCommand="radgvLocation_InsertCommand"
OnNeedDataSource="radgvLocation_NeedDataSource" OnUpdateCommand="radgvLocation_UpdateCommand"
OnDeleteCommand="radgvLocation_DeleteCommand" OnItemDataBound="radgvLocation_ItemDatabound" OnDetailTableDataBind="radgvLocation_DetailTableDataBind">
<MasterTableView CommandItemDisplay="Top" DataKeyNames="LocationID" EditMode="PopUp">
<CommandItemTemplate>
<telerik:RadToolBar ID="RadToolBar1" OnButtonClick="RadToolBar1_ButtonClick" runat="server"
Skin="Vista" Visible='<%# radgvLocation.EditIndexes.Count == 0 %>' CommandName="EditSelected"
OnClientButtonClicking="onToolBarClientButtonClicking">
<Items>
<telerik:RadToolBarButton Text="Add new" CommandName="InitInsert" ImageUrl="~/Images/AddRecord.gif"
Visible='<%# !radgvLocation.MasterTableView.IsItemInserted %>'>
</telerik:RadToolBarButton>
<telerik:RadToolBarButton Text="Edit selected" CommandName="EditSelected" ImageUrl="~/Images/Edit.gif">
</telerik:RadToolBarButton>
<telerik:RadToolBarButton Text="Delete" CommandName="DeleteSelected" ImageUrl="~/Images/Delete.gif">
</telerik:RadToolBarButton>
<telerik:RadToolBarButton Text="Refresh" CommandName="RebindGrid" ImageUrl="~/Images/Refresh.gif">
</telerik:RadToolBarButton>
</Items>
</telerik:RadToolBar>
</CommandItemTemplate>
<SortExpressions>
<telerik:GridSortExpression FieldName="LocationID" SortOrder="Descending" />
</SortExpressions>
<
CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
<Columns>
<telerik:GridTemplateColumn UniqueName="SNo" HeaderText="SNo.">
<ItemTemplate>
<asp:Label ID="lblSno" runat="server"></asp:Label>
</ItemTemplate>
<HeaderStyle Width="30px" />
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn UniqueName="LocationCode" HeaderText="LocationCode" DataField="LocationCode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="LocationName" HeaderText="LocationName" DataField="LocationName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="Address1" HeaderText="Address1" DataField="Address1">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="Address2" HeaderText="Address2" DataField="Address2">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="City" HeaderText="City" DataField="CityName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="State" HeaderText="State" DataField="StateName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="ZipCode" HeaderText="ZipCode" DataField="ZipCodeName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="Phone" HeaderText="Phone" DataField="Phone">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="Fax" HeaderText="Fax" DataField="Fax">
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings InsertCaption="Add new item" CaptionFormatString="Edit Location ID: {0}"
CaptionDataField="LocationID" PopUpSettings-Width="560" EditFormType="Template"
PopUpSettings-Modal="true">
<FormTemplate>
<table id="Table1" cellspacing="1" cellpadding="1" class="popuptbl" width="520" border="0">
<tr>
<td>
Location Code :
</td>
<td>
<telerik:RadTextBox Width="160px" ID="radtxtLocationCode" runat="server" Text='<%# Bind( "LocationCode") %>'
EmptyMessage="type here" >
</telerik:RadTextBox>
</td>
<td>
Location Name :
</td>
<td>
<telerik:RadTextBox Width="160px" ID="radtxtLocationName" runat="server" Text='<%# Bind( "LocationName") %>'
EmptyMessage="type here" >
</telerik:RadTextBox>
</td>
</tr>
<tr>
<td>
Address 1 :
</td>
<td>
<telerik:RadTextBox Width="160px" ID="radtxtAddress1" runat="server" Text='<%# Bind( "Address1") %>'
EmptyMessage="type here" >
</telerik:RadTextBox>
</td>
<td>
Address 2 :
</td>
<td>
<telerik:RadTextBox Width="160px" ID="radtxtAddress2" runat="server" Text='<%# Bind( "Address2") %>'
EmptyMessage="type here" >
</telerik:RadTextBox>
</td>
</tr>
<tr>
<td>
Country :
</td>
<td>
<telerik:RadComboBox ID="radcmbCountry" Width="160px"
DataTextField="CountryName" SelectedValue='<%# Bind( "CountryID") %>'
DataValueField="CountryID" AppendDataBoundItems="true" DataSourceID="DsCountrySelect"
AllowCustomText="false" AutoCompleteSeparator="" MarkFirstMatch="true"
runat="server" onselectedindexchanged="radcmbCountry_SelectedIndexChanged">
</telerik:RadComboBox>
</td>
<td>
State :
</td>
<td>
<telerik:RadComboBox ID="radcmbState" oncontextmenu="return false"
Width="160px" SelectedValue='<%# Bind( "StateID") %>'
runat="server" DataTextField="Name" DataValueField="StateID"
AppendDataBoundItems="true" DataSourceID="DsStateSelect" AllowCustomText="false"
AutoCompleteSeparator="" MarkFirstMatch="true"
onselectedindexchanged="radcmbState_SelectedIndexChanged" >
</telerik:RadComboBox>
</td>
</tr>
<tr>
<td>
City :
</td>
<td>
<telerik:RadComboBox ID="radcmbCity" Width="163px" DataTextField="CityName" SelectedValue='<%# Bind( "CityID") %>'
DataValueField="CityID" AppendDataBoundItems="true" DataSourceID="DsCitySelect"
AllowCustomText="false" AutoCompleteSeparator="" MarkFirstMatch="true" runat="server">
</telerik:RadComboBox>
</td>
<td>
ZipCode :
</td>
<td>
<telerik:RadComboBox ID="radcmbZipCode" Width="163px" DataTextField="ZipCodeName" SelectedValue='<%# Bind( "ZipcodeID") %>'
DataValueField="ZipCodeID" AppendDataBoundItems="true" DataSourceID="DsZipCodeSelect"
AllowCustomText="false" AutoCompleteSeparator="" MarkFirstMatch="true" runat="server">
</telerik:RadComboBox>
</td>
</tr>
<tr>
<td>
Phone :
</td>
<td>
<telerik:RadTextBox Width="160px" ID="RadTextBox1" runat="server" Text='<%# Bind( "Phone") %>'
EmptyMessage="type here" >
</telerik:RadTextBox>
</td>
<td>
Fax :
</td>
<td>
<telerik:RadTextBox Width="160px" ID="RadTextBox2" runat="server" Text='<%# Bind( "Fax") %>'
EmptyMessage="type here" >
</telerik:RadTextBox>
</td>
</tr>
</table>
<table style="width: 100%">
<tr>
<td align="right">
<asp:Button ID="Button1" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
</asp:Button>
<asp:Button ID="Button2" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">
</asp:Button>
</td>
</tr>
</table>
</FormTemplate>
<
PopUpSettings Modal="True" Width="560px"></PopUpSettings>
</EditFormSettings>
</MasterTableView>
<ClientSettings>
<Selecting AllowRowSelect="True" EnableDragToSelectRows="True" />
</ClientSettings>
</telerik:RadGrid>
protected
void radgvLocation_ItemCommand(object source, GridCommandEventArgs e)
{
 
switch (e.CommandName)
{
case "UpdateCountry":
RadComboBox radcmbCountry = (RadComboBox)e.Item.FindControl("radcmbCountry");
break;
 
case "UpdateState":
RadComboBox radcmbState = (RadComboBox)e.Item.FindControl("radcmbState");
break;
 
}
radgvLocation.Rebind();
}
 
protected void radgvLocation_ItemCreated(object sender, GridItemEventArgs e)
{
 
// GridEditFormItem editForm = e.Item as GridEditFormItem;
 
if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
{
RadComboBox radcmbCountry = (e.Item as GridEditFormItem)["radcmbCountry"].Controls[0] as RadComboBox;
radcmbCountry.AutoPostBack =
true;
radcmbCountry.SelectedIndexChanged +=
new System.EventHandler(this.radcmbCountry_SelectedIndexChanged);
 
RadComboBox radcmbState = (e.Item as GridEditFormItem)["radcmbState"].Controls[0] as RadComboBox;
radcmbState.AutoPostBack =
true;
radcmbState.SelectedIndexChanged +=
new System.EventHandler(this.radcmbState_SelectedIndexChanged);
 //// above line causes error
 
}
}
protected void radcmbCountry_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
{
}
protected void radcmbState_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
{
}
I'm using an EntityDataSource with the RadGrid. Everything was working fine until I added a GridCalculatedColumn. Suddenly, I'm getting this error:
No property or field 'RecordID' exists in type 'EntityDataSourceWrapper'
As you see in the markup at the end of the message, I'm declaring the EntityDataSource declaratively. I encountered a similar problem with the EntityDataSourceWrapper previously in the code behind and managed to find a fix that I posted here:
http://weblogs.asp.net/kencox/archive/2009/07/16/fixing-entitydatasourcewrapper-error-in-ef-vb-version.aspx
Does anyone know a workaround for this when using the EntityDataSource declaratively?
Ken
<telerik:RadGrid ID="RadGridSalesDetail" runat="server" AutoGenerateDeleteColumn="True" |
AutoGenerateEditColumn="True" AllowAutomaticUpdates="True" AllowAutomaticDeletes="True" |
AllowAutomaticInserts="True" DataSourceID="EntityDataSource1" GridLines="None"> |
<MasterTableView AutoGenerateColumns="False" DataKeyNames="RecordID" DataSourceID="EntityDataSource1"> |
<RowIndicatorColumn> |
<HeaderStyle Width="20px"></HeaderStyle> |
</RowIndicatorColumn> |
<ExpandCollapseColumn> |
<HeaderStyle Width="20px"></HeaderStyle> |
</ExpandCollapseColumn> |
<Columns> |
<telerik:GridBoundColumn DataField="RecordID" DataType="System.Int32" HeaderText="RecordID" |
ReadOnly="True" SortExpression="RecordID" UniqueName="RecordID"> |
</telerik:GridBoundColumn> |
<telerik:GridDropDownColumn DataField="PartNumber" DataSourceID="edsPartNumberLookup" |
HeaderText="Part Number" ListTextField="PartNumber" ListValueField="PartNumber" |
UniqueName="DetailPartNumber" ColumnEditorID="GridDropDownColumnEditor1"> |
</telerik:GridDropDownColumn> |
<telerik:GridNumericColumn DataField="Qty" HeaderText="Quantity" DataType="System.Int32" |
UniqueName="DetailQty" ColumnEditorID="GridNumericColumnEditor1"> |
</telerik:GridNumericColumn> |
<telerik:GridBoundColumn DataField="SoldPrice" DataType="System.Double" HeaderText="SoldPrice" |
SortExpression="SoldPrice" UniqueName="SoldPrice"> |
</telerik:GridBoundColumn> |
<telerik:GridCalculatedColumn HeaderText="Total Price" UniqueName="TotalPrice" DataType="System.Double" |
DataFields="Qty, SoldPrice" Expression="{0}*{1}" FooterText="Total : " Aggregate="Sum" /> |
</Columns> |
</MasterTableView> |
</telerik:RadGrid> |
<telerik:GridDropDownListColumnEditor ID="GridDropDownColumnEditor1" runat="server" |
DropDownStyle-Width="110px" /> |
<telerik:GridNumericColumnEditor ID="GridNumericColumnEditor1" runat="server" NumericTextBox-Width="40px" /> |
</div> |
<asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=OfficeBookDBEntities1" |
DefaultContainerName="OfficeBookDBEntities1" EntitySetName="CMS_SaleDetail" EnableDelete="True" |
EnableInsert="True" EnableUpdate="True" EntityTypeFilter="CMS_SaleDetail"> |
</asp:EntityDataSource> |