or
<telerik:RadChart ID="RadChart2" runat="server" Height="400px" Visible ="false" Skin ="DeepBlue" Width="900px" OnItemDataBound="RadChart2_ItemDataBound" AutoLayout="true" AutoTextWrap="true" IntelligentLabelsEnabled ="true" > <Series> <telerik:ChartSeries Name="Cost_Of_Job" Type="Pie" DataYColumn="Count" > <Appearance LegendDisplayMode="ItemLabels"> </Appearance> </telerik:ChartSeries> <telerik:ChartSeries Name="Total_Invoice" Type="Pie" DataYColumn="Count" Visible ="false"> <Appearance LegendDisplayMode="ItemLabels"> </Appearance> </telerik:ChartSeries> </Series> </telerik:RadChart>Protected Sub UpdateChart2(ByVal one As Double, ByVal two As Double, ByVal three As Double, ByVal four As Double, ByVal five As Double, ByVal six As Double, ByVal seven As Double, ByVal eight As Double, ByVal nine As Double) Try tblCostInvoiceheader.Visible = True tblCostInvoiceDetails.Visible = True RadChart2.ChartTitle.TextBlock.Text = cbChartBy.Text Dim salesSeries As ChartSeries = RadChart2.GetSeries("Cost_Of_Job") Dim InvoiceSeries As ChartSeries = RadChart2.GetSeries("Total_Invoice") InvoiceSeries.Visible = False InvoiceRow.Visible = False Dim Total As Double = 0 Dim one1 As Double = one Dim two1 As Double = two Dim three1 As Double = three Dim four1 As Double = four Dim five1 As Double = five Dim six1 As Double = six Dim seven1 As Double = seven Dim eight1 As Double = eight Dim nine1 As Double = nine Total = (one + two + three + four + five + six + seven + eight + nine) one1 = ((one / Total) * 100) two1 = ((two / Total) * 100) three1 = ((three / Total) * 100) four1 = ((four / Total) * 100) five1 = ((five / Total) * 100) six1 = ((six / Total) * 100) seven1 = ((seven / Total) * 100) eight1 = ((eight / Total) * 100) nine1 = ((nine / Total) * 100)
Dim dt As New DataTable
dt.Columns.Add("Invoice") dt.Columns.Add("Count") dt.Rows.Add(cbInvoiceStatus.Items(0).Text, one1) dt.Rows.Add(cbInvoiceStatus.Items(1).Text, two1) dt.Rows.Add(cbInvoiceStatus.Items(2).Text, three1) dt.Rows.Add(cbInvoiceStatus.Items(3).Text, four1) dt.Rows.Add(cbInvoiceStatus.Items(4).Text, five1) dt.Rows.Add(cbInvoiceStatus.Items(5).Text, six1) dt.Rows.Add(cbInvoiceStatus.Items(6).Text, seven1) dt.Rows.Add(cbInvoiceStatus.Items(7).Text, eight1) dt.Rows.Add(cbInvoiceStatus.Items(8).Text, nine1) RadChart2.Series(0).DataYColumn = "Count" RadChart2.DataSource = dt RadChart2.DataBind() txtBillable.Text = one txtBillableST.Text = two txtStartUp.Text = three txtStartupST.Text = four txtTraningService.Text = five txtTrainingSTService.Text = six txtWarranty.Text = seven txtWarrantyST.Text = eight txtUnspecifiedCost.Text = nine 'if Invoice vs Cost If cbChartBy.Text = "Invoice vs Cost" Then Call CostVSInvoice() InvoiceRow.Visible = True InvoiceSeries.Visible = True Dim Total1 As Double = 0 Dim one2 As Double = 0 Dim two2 As Double = 0 Dim three2 As Double = 0 Dim four2 As Double = 0 Dim five2 As Double = 0 Dim six2 As Double = 0 Dim seven2 As Double = 0 Dim eight2 As Double = 0 Dim nine2 As Double = 0 Total1 = (CountInvBillable + CountInvBillableST + CountInvStartUp + CountInvStartUpST + CountInvTrainingService + CountInvTrainingSTService + CountInvWarranty + CountInvWarrantyST + CountInvCost) one2 = ((CountInvBillable / Total1) * 100) two2 = ((CountInvBillableST / Total1) * 100) three2 = ((CountInvStartUp / Total1) * 100) four2 = ((CountInvStartUpST / Total1) * 100) five2 = ((CountInvTrainingService / Total1) * 100) six2 = ((CountInvTrainingSTService / Total1) * 100) seven2 = ((CountInvWarranty / Total1) * 100) eight2 = ((CountInvWarrantyST / Total1) * 100) nine2 = ((CountInvCost / Total1) * 100) Dim dt1 As New DataTable dt1.Columns.Add("Invoice") dt1.Columns.Add("Count") dt1.Rows.Add(cbInvoiceStatus.Items(0).Text, one2) dt1.Rows.Add(cbInvoiceStatus.Items(1).Text, two2) dt1.Rows.Add(cbInvoiceStatus.Items(2).Text, three2) dt1.Rows.Add(cbInvoiceStatus.Items(3).Text, four2) dt1.Rows.Add(cbInvoiceStatus.Items(4).Text, five2) dt1.Rows.Add(cbInvoiceStatus.Items(5).Text, six2) dt1.Rows.Add(cbInvoiceStatus.Items(6).Text, seven2) dt1.Rows.Add(cbInvoiceStatus.Items(7).Text, eight2) dt1.Rows.Add(cbInvoiceStatus.Items(8).Text, nine2) RadChart2.Series(1).DataXColumn = "Count" RadChart2.DataSource = dt1 RadChart2.DataBind() txtInvBillable.Text = CountInvBillable txtInvBillableST.Text = CountInvBillableST txtInvStartUp.Text = CountInvStartUp txtInvStartUpST.Text = CountInvStartUpST txtInvTrainingService.Text = CountInvTrainingService txtInvTrainingSTService.Text = CountInvTrainingSTService txtInvWarranty.Text = CountInvWarranty txtInvWarrantyST.Text = CountInvWarrantyST txtUnspecifiedInvoice.Text = CountInvCost End If Catch ex As Exception RadWindowManagerchartbyInvoice.RadAlert(Replace(ex.Message.ToString, "'", "\'"), 380, 100, "Error-UpdateChart2", "") End Try End SubHi, I have datakeyname value. I need to get a row using this key value out of Radgrid events. All the code
is in Radgrid events. Out of Radgrid events means, they suggest to loop thru Rows and get a row like this: Foreach (GridDataItem row in Radgrid1.Items) { If (row.GetDataKeyValue(“ID”).ToString() == “100”) Row.Remove; } One more thing is that when that particular row is found, I need to delete it from grid.
But GridDatItem (row) doesn’t have delete or remove method. It has only dispose. I don’t think dispose
does the job of delete. I don’t want grid to be rebound after deleting row. Please suggest how to do it. We are not using needsource event to bind grid. Our architecture will not
suit to use it. So, we bind the grid where ever necessary. I need to have this code for our page to work. Thanks, Prathiba. string start = RadTimePickerstartschedule.SelectedTime.ToString("hh:mm:tt");
but I am getting an error that there is no ToString() that takes 1 argument. Actually the radtimepicker displays date in am/pm format but when I checked in C# code, its automatically converted to 24 clock format. How can I convert the time to am/pm format?<telerik:GridTemplateColumn HeaderText="Origin"> <ItemTemplate> <%#DataBinder.Eval(Container.DataItem, "Origin")%> </ItemTemplate> <EditItemTemplate> <telerik:RadComboBox runat="server" ID="RadComboBox5" DataTextField="Origin" OnItemsRequested="RadComboBox5_ItemsRequested" EnableLoadOnDemand="true" DataValueField="OriginId" OnSelectedIndexChanged="RadComboBox5_SelectedIndexChanged" DataSourceID="OriginDataSource" SelectedValue='<%#Bind("OriginId") %>'> </telerik:RadComboBox> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="Destination"> <ItemTemplate> <%#DataBinder.Eval(Container.DataItem, "Destination")%> </ItemTemplate> <EditItemTemplate> <telerik:RadComboBox runat="server" ID="RadComboBox6" DataTextField="Destination" EnableAutomaticLoadOnDemand="true" OnItemsRequested="RadComboBox6_ItemsRequested" DataValueField="DestinationId" OnSelectedIndexChanged="RadComboBox6_SelectedIndexChanged" DataSourceID="ConsigneesDataSource" SelectedValue='<%#Bind("DestinationId") %>'> </telerik:RadComboBox> </EditItemTemplate> </telerik:GridTemplateColumn>protected void RadComboBox5_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e) { string sql = "SELECT [CityId], [CityName] FROM [Loications] WHERE CityName LIKE @CityName + '%'"; SqlDataAdapter adapter = new SqlDataAdapter(sql, ConfigurationManager.ConnectionStrings["test"].ConnectionString); adapter.SelectCommand.Parameters.AddWithValue("@CityName", e.Text); DataTable dt = new DataTable(); adapter.Fill(dt); RadComboBox comboBox = (RadComboBox)sender; comboBox.Items.Clear(); foreach (DataRow row in dt.Rows) { RadComboBoxItem item = new RadComboBoxItem(); item.Text = row["CityName"].ToString(); item.Value = row["CityId"].ToString(); comboBox.Items.Add(item); item.DataBind(); } } protected void RadComboBox5_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { Session["CityId"] = e.Value; } protected void RadComboBox6_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e) { string sql = "SELECT [CityId], [CityName] FROM [Locations] WHERE CityName LIKE @CityName + '%'"; SqlDataAdapter adapter = new SqlDataAdapter(sql, ConfigurationManager.ConnectionStrings["test"].ConnectionString); adapter.SelectCommand.Parameters.AddWithValue("@CityName", e.Text); DataTable dt = new DataTable(); adapter.Fill(dt); RadComboBox comboBox = (RadComboBox)sender; comboBox.Items.Clear(); foreach (DataRow row in dt.Rows) { RadComboBoxItem item = new RadComboBoxItem(); item.Text = row["CityName"].ToString(); item.Value = row["CityId"].ToString(); comboBox.Items.Add(item); item.DataBind(); } } protected void RadComboBox6_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { Session["CityId"] = e.Value; }<asp:SqlDataSource ID="MasterViewDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:test %>" SelectCommand="SELECT Orders.OrderId, a1.CityName AS Origin, a2.CityName AS DestinationFROM Orders INNER JOIN Locations AS a1 ON a1.CityId = TransactsData.ShiprId INNER JOIN Locations AS a2 ON a2.CityId = TransactsData.ConsId " InsertCommand="INSERT INTO [Orders] ([OriginId], [DestinationId], [TimeCreated]) VALUES (@OriginId, @DestinationId, GETDATE())" UpdateCommand="UPDATE [Orders] SET [OriginId] = @OriginId,
[DestinationId] = @DestinationId, [TimeUpdated] = @GETTIME()"><asp:SqlDataSource ID="OriginDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:test %>" SelectCommand="SELECT [CityId], [CityName] FROM [Locations]"></asp:SqlDataSource> <asp:SqlDataSource ID="DestinationDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:test %>" SelectCommand="SELECT [CityId], [CityName] FROM [Locations]"></asp:SqlDataSource><EditFormSettings EditFormType="Template" > <FormTableItemStyle width="100%"></FormTableItemStyle> <FormTableStyle GridLines="None" CellSpacing="0" CellPadding="2"></FormTableStyle> <FormStyle Width="100%" backColor="white"></FormStyle> <FormTemplate> <div runat="server" id="divManageObligation" class="ContentSettings"> <asp:HiddenField runat="server" ID="hdnManageObligations"/> <telerik:RadTabStrip runat="server" ID="rtsManageObligations" MultiPageID="rmpMultiPage" OnClientTabSelecting="OnTabSelecting" OnTabClick="rtsManageObligations_TabClick" Width="100%"> <Tabs> <telerik:RadTab runat="server" Text="<%$ Resources:ui_labels, rtProgramDetails %>" Value="AlwaysLoaded"></telerik:RadTab> <telerik:RadTab runat="server" Text="<%$ Resources:ui_labels, rtObligations %>" ></telerik:RadTab> <telerik:RadTab runat="server" Text="<%$ Resources:ui_labels, rtAssistantshipHistory %>"></telerik:RadTab> <telerik:RadTab runat="server" Text="<%$ Resources:ui_labels, rtRegistrationHistory %>"></telerik:RadTab> </Tabs>function OnTabSelecting(sender, args) { var editedItemsArray = $find("<%=rgCandidateList.ClientID %>").get_masterTableView().get_editItems(); ; var editFormItem = editedItemsArray[0].get_editFormItem(); var hdnManageObligations = $telerik.findElement(editFormItem, 'hdnManageObligations'); hdnManageObligations.value = true; if (args.get_tab().get_value()) { args.get_tab().set_postBack(false); }} Protected Sub rgCandidateList_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgCandidateList.ItemCreated Dim editItem As GridEditFormItem...some code removed..... ElseIf TypeOf e.Item Is GridEditFormItem And e.Item.IsInEditMode Then editItem = CType(e.Item, GridEditFormItem) Dim a As HiddenField Dim b As String a = CType(editItem.FindControl("hdnManageObligations"), HiddenField) b = a.value If CType(editItem.FindControl("hdnManageObligations"), HiddenField).Value = "true" Then editItem.FindControl("divManageObligation").Visible = True editItem.FindControl("divDecision").Visible = False Else..... rest of code removed.item.FireCommandEvent(RadGrid.UpdateCommandName, string.Empty);. Please help
Thank you