Hi,
I am not able to access the label field in the radgrid using javascript. I used find element also ... plz give solution...
function SelectTaxLotAction(objSelectedCheckobx)
{
var totalsharevalue = document.getElementById("lblTotalSharesValue").innerHTML;
var SumShares = 0;
var LossGainValue = 0;
var grid = $find('<%= rgUpdateTaxlot.ClientID %>');
var radGridTable = grid.get_masterTableView();
var radGridTableRows = radGridTable._element.rows;
for (var i = 0; i < radGridTable.get_dataItems().length; i++) {
var ele = radGridTableRows[i].getElementsByTagName("input");
if ((ele[0] != undefined) && (ele[0].type == 'checkbox')) {
var chk = document.getElementById(ele[0].id)
if(chk.checked)
{
var txtAllocatevalue = radGridTable.get_dataItems()[i].findControl("lblPricevalue").get_value();
var txtSharesvalue = radGridTable.get_dataItems()[i].findControl("lblsharevalue").get_value() ;
var txtPricevalue = radGridTable.get_dataItems()[i].findControl("lblTotalvalue").get_value() ;
LossGainValue = Math.abs(LossGainValue) + ((Math.abs(totalsharevalue) - Math.abs(txtPricevalue))*Math.abs(txtSharesvalue));
SumShares = Math.abs(SumShares)+Math.abs(txtAllocatevalue);
}
}
}
var lblTotalAssignedvalue = document.getElementById("lblTotalAssignedvalue");
var lblGainLossvalue = document.getElementById("lblGainLossvalue");
lblTotalAssignedvalue.innerHTML = SumShares;
lblGainLossvalue.innerHTML = LossGainValue;
}
<telerik:RadRotator ID="RadRotator1" runat="server" Height="120px" Width="680px" ScrollDuration="500" ScrollDirection="Right" FrameDuration="1500" ItemWidth="120px" ItemHeight="100px" RotatorType="AutomaticAdvance" DataSourceID="SqlDataSource1"> <ItemTemplate> <asp:Image ID="image1" runat="server" CssClass="image" ImageAlign="left" Visible="true" ImageUrl='<%# String.Format("~/upload data/movies/{0}", DataBinder.Eval(Container.DataItem, "imagename")) %>' /> </ItemTemplate></telerik:RadRotator><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:cinema mistakesConnectionString %>" SelectCommand="SELECT TOP 10 [imagename] FROM [movie] ORDER BY [mid] DESC"></asp:SqlDataSource>I have a problem with the master/detail hierarchy in case of many to many relationship with the entity framework I use an object data source to bind the data to the grid and in the expand collapse command I use the parent item data key to fill the session and bind the data of the detail table so when I expand all the records in the detail they showed right but when I try to just add a new row to this detail the detail binds but the it shows the wrong records and this a copy of my aspx code
<TMS:TelerikGrid ID="gridScoutingProfiles" OnNeedDataSource="gridScoutingProfiles_NeedDataSource" OnDetailTableDataBind="gridScoutingProfiles_DetailTableDataBind" OnInsertCommand="gridScoutingProfiles_InsertCommand"OnItemCommand="gridScoutingProfiles_ItemCommand" runat="server" AllowAutomaticDeletes="true"AllowAutomaticInserts="true" AllowAutomaticUpdates="true" DataSourceID="objDSScoutingProfiles" AllowPaging="true" GridLines="Both"> <MasterTableView AutoGenerateColumns="false" DataKeyNames="ScoutingProfileID" CommandItemDisplay="Top"> <Columns> <Telerik:GridEditCommandColumn EditText="<%$Resources :Common,EditCommand %>" UniqueName="EditColumn" /> <Telerik:GridButtonColumn Text="<%$Resources :Common,DeleteCommand %>" CommandName="Delete" ConfirmText="<%$Resources :Common,DeleteRecordConfirmationMessage %>" /> <Telerik:GridTemplateColumn HeaderText="Scouting Profile Name" UniqueName="ScoutingProfileName" SortExpression="ScoutingProfileName"> <ItemTemplate> <asp:Label runat="server" ID="lblScoutingProfileName" Text='<%#Eval("ScoutingProfileName") %>'</asp:Label> </ItemTemplate> <EditItemTemplate> <asp:TextBox runat="server" Text='<%#Bind("ScoutingProfileName")%>' ID="txtScoutingProfileName</asp:TextBox> <TMS:RequiredFieldValidator ID="rfvScoutingProfileName" runat="server ControlToValidate="txtScoutingProfileName</TMS:RequiredFieldValidator> </EditItemTemplate> </Telerik:GridTemplateColumn> </Columns> <DetailTables> <Telerik:GridTableView CommandItemDisplay="Top DataKeyNames="SkillID" DataSourceID="objDSScoutingProfileSkills" Caption="Skills" AllowAutomaticDeletes="True" runat="server" AllowPaging="True" AllowAutomaticUpdates="true" AllowAutomaticInserts="true" AutoGenerateColumns="false"> <Columns> <Telerik:GridButtonColumn Text="<%$Resources :Common,DeleteCommand %>" CommandName="Delete" ConfirmText="<%$Resources :Common,DeleteRecordConfirmationMessage %>" /> <Telerik:GridTemplateColumn HeaderText="Skill Name" UniqueName="SkillName" SortExpression="SkillName"> <ItemTemplate> <asp:Label runat="server" ID="lblSkillName" Text='<%#Eval("SkillName") %>'></asp:Label> </ItemTemplate> <EditItemTemplate> <Telerik:RadComboBox runat="server" SelectedValue='<%#Bind("SkillID") %>' ID="cmbSkills" DataSourceID="objDSSkills" DataTextField="SkillName" DataValueField="SkillID"> </Telerik:RadComboBox> <TMS:RequiredFieldValidator ID="rfvSkillName" runat="server" ControlToValidate="cmbSkills"> </TMS:RequiredFieldValidator> </EditItemTemplate> </Telerik:GridTemplateColumn> </Columns> </Telerik:GridTableView> </DetailTables> </MasterTableView> </TMS:TelerikGrid>and this a copy of my cs code
protected void gridScoutingProfiles_ItemCommand(object source, GridCommandEventArgs e) { if (e.CommandName == "ExpandCollapse") { Session["scoutingProfileID"] = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ScoutingProfileID"].ToString(); } } protected void gridScoutingProfiles_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) { GridDataItem ParentItem = e.Item.OwnerTableView.ParentItem as GridDataItem; if (ParentItem != null) Session["scoutingProfileID"] = ParentItem.OwnerTableView.DataKeyValues[ParentItem.ItemIndex]["ScoutingProfileID"].ToString(); }

<
EditItemTemplate>
<telerik:RadComboBox Height="100px" Width="150px" Skin="WebBlue" ID="RadCboBusinessUnit" runat="server"
EnableVirtualScrolling="true" EmptyMessage="Please Select..." MarkFirstMatch="true" AllowCustomText="true" CausesValidation ="false"
Text ='<%# DataBinder.Eval(Container.DataItem,"BusinessUnit" )%>' AutoPostBack ="true" OnSelectedIndexChanged = "RadCboBusinessUnit_SelectedIndexChanged" >
</telerik:RadComboBox>
<span class="lbl_Mandatory">*</span>
<asp:RequiredFieldValidator ID="ValidateBusinessUnit" runat="server" ControlToValidate ="RadCboBusinessUnit" ErrorMessage="Value Is Required"></asp:RequiredFieldValidator>
</EditItemTemplate>
FYI -- The below code is actually causing out the issue.
<
telerik:AjaxSetting AjaxControlID="RadCboBusinessUnit">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadCboBusinessUnit" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
Thank You!
Gurubaran
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"Skin="Office2007"KeepInScreenBounds="true"Behaviors="Move, Close"> <Windows> <telerik:RadWindow runat="server" ID="rwGeneral" AutoSize="true" Modal="true" Title="" OnClientPageLoad="OnClientPageLoad" /> </Windows> </telerik:RadWindowManager>function getRadWindow() { return $find('<%# rwGeneral.ClientID %>'); } function openRadWindow(url, Title) { var oWnd = getRadWindow(); if (Title) oWnd.set_title(Title); oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Resize) oWnd.setUrl(url); oWnd.show(); return false; }function popBranchPicker() { var radWindow = getRadWindow(); radWindow.add_close(radWindow_OnClientClose); openRadWindow('<%= BranchPickerPopupUrl %>', 'Branch Picker'); return false; } function radWindow_OnClientClose(oWnd, args) { // clean up the close method var radWindow = getRadWindow(); radWindow.remove_close(radWindow_OnClientClose); // refresh here var btnRefresh = document.getElementById('<%= btnRefreshBMDashboardAndPicker.ClientID %>'); btnRefresh.click(); return false; } GetRadWindow().add_close(doClose); function GetRadWindow() { var oWindow = null; if (window.radWindow) oWindow = window.radWindow; // Will work in Moz in all cases, including clasic dialog else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; // IE (and Moz az well) return oWindow; } function CloseOnReload() { GetRadWindow().Close(); } function doClose() { document.forms[0].submit(); } // some stuff here RadAjaxPanel1.ResponseScripts.Add("CloseOnReload();"); <asp:Content ID="Content2" ContentPlaceHolderID="cphContenido" runat="server"> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="rggrupos"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="rggrupos" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="ImageButton1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="rgotros" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <br /> <telerik:RadGrid ID="rggrupos" DataSourceID="dsGrupos" runat="server" AutoGenerateColumns="False" GridLines="none"> <MasterTableView Width="100%"> <GroupByExpressions> <telerik:GridGroupByExpression> <SelectFields> <telerik:GridGroupByField FieldAlias="Grupo" FieldName="grupo"></telerik:GridGroupByField> </SelectFields> <GroupByFields> <telerik:GridGroupByField FieldName="grupo" SortOrder="Ascending"></telerik:GridGroupByField> </GroupByFields> </telerik:GridGroupByExpression> </GroupByExpressions> <Columns> <telerik:GridBoundColumn ColumnEditorID="usuario" UniqueName="usuario" SortExpression="usuario" HeaderText="" HeaderButtonType="TextButton" DataField="usuario"> </telerik:GridBoundColumn> <telerik:GridTemplateColumn UniqueName="temprespseg" HeaderText="RESPSEG" > <ItemTemplate> <asp:CheckBox ID="chkrespseg" runat="server"/> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn UniqueName="tempatender" HeaderText="ATENDER" > <ItemTemplate> <asp:CheckBox ID="chkatender" runat="server" /> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn UniqueName="tempcomentar" HeaderText="COMENTAR" > <ItemTemplate> <asp:CheckBox ID="chkcomentar" runat="server" /> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn UniqueName="tempenterar" HeaderText="ENTERAR" > <ItemTemplate> <asp:CheckBox ID="chkenterar" runat="server" /> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn UniqueName="temparchivar" HeaderText="ARCHIVAR" > <ItemTemplate> <asp:CheckBox ID="chkarchivar" runat="server" /> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> </telerik:RadGrid> <asp:SqlDataSource ID="dsGrupos" runat="server" ConnectionString="<%$ ConnectionStrings:MatrizTurnadoConnectionString %>" SelectCommand="SELECT * FROM [usuariosgrupo] Where owner = 'CJ398'"> </asp:SqlDataSource> <br /> <table> <tr> <td> <asp:Label ID="Label1" runat="server" Text="AGREGAR OTROS CONTACTOS"></asp:Label> </td> <td> <telerik:RadComboBox EmptyMessage="Selecciona Usuario" EnableLoadOnDemand="True" ShowMoreResultsBox="true" EnableVirtualScrolling="true" ID="rcbotros" Runat="server" DataSourceID="dsusuario" DataTextField="NC" DataValueField="emailLotusInt" Height="100px" Width="362px"> </telerik:RadComboBox> </td> <td><asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/agregar.bmp" Height="16px" Width="18px" /> </td></tr></table> <asp:SqlDataSource ID="dsusuario" runat="server" ConnectionString="<%$ ConnectionStrings:cnnIntranet %>" SelectCommand="SELECT [RPE], [Nombre], [Apellido1], [Apellido2], [NombreCompleto], [emailLotusInt], RTRIM(Apellido1) + ' ' + RTRIM(Apellido2) + ' ' + Nombre As NC FROM [Usuarios] WHERE ([emailLotusInt] IS NOT NULL) ORDER BY NC"> </asp:SqlDataSource> <br /> <telerik:RadGrid ID="rgotros" runat="server" AutoGenerateColumns="False" GridLines="None"> <ClientSettings> <Selecting AllowRowSelect="True" /> </ClientSettings> <MasterTableView> <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings> <Columns> <telerik:GridBoundColumn DataField="txtnombre" UniqueName="txtnombre" HeaderText=""> </telerik:GridBoundColumn> <telerik:GridTemplateColumn UniqueName="temprespseg" HeaderText="RESPSEG" > <ItemTemplate> <asp:CheckBox ID="chkrespseg" runat="server"/> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn UniqueName="tempatender" HeaderText="ATENDER" > <ItemTemplate> <asp:CheckBox ID="chkatender" runat="server" /> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn UniqueName="tempcomentar" HeaderText="COMENTAR" > <ItemTemplate> <asp:CheckBox ID="chkcomentar" runat="server" /> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn UniqueName="tempenterar" HeaderText="ENTERAR" > <ItemTemplate> <asp:CheckBox ID="chkenterar" runat="server" /> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn UniqueName="temparchivar" HeaderText="ARCHIVAR" > <ItemTemplate> <asp:CheckBox ID="chkarchivar" runat="server" /> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridButtonColumn Text="Borrar" CommandName="Delete"></telerik:GridButtonColumn> </Columns> </MasterTableView> </telerik:RadGrid> <br /> </asp:Content>Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Request("id") = "" Then 'Response.Redirect("inbox.aspx") End If If Not IsPostBack Then rggrupos.DataSourceID = "dsGrupos" dsGrupos.SelectCommand = "SELECT * FROM [usuariosgrupo] Where owner = '" & Request("rpe") & "'" Me.rggrupos.DataBind() End If End SubProtected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnotro.Click If MyDataTable.Columns.Count = 0 Then MyDataTable.Columns.Add("txtnombre") End If Dim selectedvalue As String = rcbotros.SelectedItem.Text MyDataTable.Rows.Add(selectedvalue) rgotros.Rebind() End SubProtected Sub rgotros_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgotros.ItemCommand If e.CommandName = "Delete" Then Dim txtnombre As String = CType(e.Item, GridDataItem)("txtnombre").Text MyDataTable.Rows.Remove(MyDataTable.Select("txtnombre = '" & txtnombre & "'").First()) rgotros.Rebind() End If End SubPublic Property MyDataTable() As DataTable Get If Session("MyDataTable") Is Nothing Then Session("MyDataTable") = New DataTable() End If Return CType(Session("MyDataTable"), DataTable) End Get Set(ByVal Value As DataTable) Session("MyDataTable") = Value End Set End Property Protected Sub RadGrid1_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rgotros.NeedDataSource rgotros.DataSource = MyDataTable End SubMensaje: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500 LÃnea: 6 Carácter: 84093 Código: 0 URI: http://MatrizTurnadoWeb/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d4.0.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aes-ES%3a1f68db6e-ab92-4c56-8744-13e09bf43565%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2010.2.713.40%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aes-ES%3a1814ab69-dbf3-46be-b5e4-1b4e7d85f183%3a16e4e7cd%3aed16cbdc%3ab7778d6c%3a58366029%3af7645509%3a24ee1bba%3a1e771326%3aaa288e2d%3a874f8ea2%3adc7e0bd%3a1569bb5f%3a63b115ed%3a30f1f089%3a19620875%3a490a9d4e