Telerik Forums
UI for WinForms Forum
1 answer
830 views

Hi,

I'm having a hard time trying to get a datetime value from my gridview to string in the correct format that I have set to display on the gridview.

 

I want:   yyyy/MM/dd HH:ss ex. 2020/01/30 14:15

But the result keeps giving me 1/23/2020 2:05:08 PM

Then to string with all the non-alphanumeric removed it gives me: 1232020258PM   (noticed it removed any 0s in front of the mins and secs...

 

I have already formatted the datetime on the gridview to display the correct format. But the value to string still gives me the other format.

I've also tried to grab the data from Sql database instead of gridview, however I still get the same result.

 

Ultimately, I need the correct format in the string so that I can eventually take it apart again to put in a different table.  And why it will be in string is because i need to grab this info to include in the name of the PDF file.  Then I'll make a table using info from the name breakdown to pull the PDF to put info a table to select it.

Help?  Thank you!!!

My code:

private void radGridView1_CommandCellClick(object sender, GridViewCellEventArgs e)
       {
           plantCode = radGridView1.CurrentRow.Cells["plantCode"].Value.ToString();
           machine = radGridView1.CurrentRow.Cells["machine"].Value.ToString();
           ordNum = radGridView1.CurrentRow.Cells["productionOrderNum"].Value.ToString().Substring(0, 7);
           ordItem = radGridView1.CurrentRow.Cells["productionOrderNum"].Value.ToString().Substring(8, 3);
           apprStatus = radGridView1.CurrentRow.Cells["approvalList"].Value.ToString();
           custName = radGridView1.CurrentRow.Cells["addrName"].Value.ToString();
           process = radGridView1.CurrentRow.Cells["process"].Value.ToString();
           prodCode = radGridView1.CurrentRow.Cells["prodCode"].Value.ToString();
           custId = radGridView1.CurrentRow.Cells["custId"].Value.ToString();
           approvalTime = Regex.Replace(radGridView1.CurrentRow.Cells["approvalTime"].Value.ToString(), "[^a-zA-Z0-9]", "");

 

See I already formatted it on the datetime column in the gridview and this works fine displaying in the gridview:

gridViewTextBoxColumn16.DataType = typeof(System.DateTime);
gridViewTextBoxColumn16.FieldName = "approvalTime";
gridViewTextBoxColumn16.FormatString = "{0:yyyy/MM/dd HH:mm}";
gridViewTextBoxColumn16.HeaderText = "approvalTime";
gridViewTextBoxColumn16.IsVisible = false;
gridViewTextBoxColumn16.Name = "approvalTime";
gridViewTextBoxColumn16.ReadOnly = true;
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 31 Jan 2020
2 answers
260 views
RadMenu contains several RadMenuItems. When I click on RadMenuItem and move the mouse pointer to another RadMenuItem, is the opening RadMenuItem. But I do not need that would hover on the other it does not open RadMenuItem.
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 30 Jan 2020
1 answer
193 views

Hi

Thanks for great popup editor.

i wanna have a grid inside the popup editor and set drop down style of popup editor to dropdown because the user can use auto complete like in dropdownlist.

but i wanna auto complete ocure on all grid rows and suggest what the user type. the text must be contains and not start with.

is it possible? and if possible give me sample

thanks in advanced

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 30 Jan 2020
1 answer
228 views

Hi,

I want to add hand cursor in RadMenuItem.

Waiting for your favorable response.

Thanks..

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 30 Jan 2020
3 answers
212 views

Hello Team Telerik,

Is there any way to reproduce the cart component attached? We are working on a POS solution and reproducing the item is crucial for us. We are currently trying Telerik for Winforms.

Nadya | Tech Support Engineer
Telerik team
 answered on 30 Jan 2020
1 answer
2.2K+ views

Hi Team, 

I am unable to find the direct download links for older versions of telerik. I am looking for for 2018 R3 version for windows. 

Thanks, 

Vijay

Nadya | Tech Support Engineer
Telerik team
 answered on 28 Jan 2020
8 answers
371 views

Hi,

I have a grid-view with multiple grids working together, and one of the tasks at hand is if a value changes in a cell in one grid, then the main grid has to highlight any objects that shared that data that were affected by the change. The customer then needs to compile that data and at that point, the row for that object needs to have the highlight removed. I am able to get the conditional formatting for the highlight to work, but removing it from the entire row after the button click is proving to be a challenge. currently my code is set to do this using the following:

      public void GridHighLighterSetConditions()
      {
         int x = -1;
         double Index1 = - 1;
         double Index2 = - 1;
         double Index3 = - 1;
         string MIDindex = "";
         int RowIndex = 0;
         int MID = 0;


         foreach (GridViewDataRowInfo Index in MainGridView.SelectedRows)
         {

            if (MainGridView.SelectedRows.Count > 0)
            {
               for (x = 0; x < MainGridView.SelectedRows.Count; x++)
               {
                  RowIndex = MainGridView.SelectedRows[x].Index;

                  MIDindex = MainGridVIew.Rows[RowIndex].Cells[0].Value.ToString();

                  MID = int.Parse(MIDindex);
               }
               break;
            }
         }

         foreach (GridViewDataRowInfo Event in GridView2.Rows)

         {

            if (GridView2.SelectedRows.Count > 0)
            {
               for (x = 0; x < GridView2.SelectedRows.Count; x++)
               {
                  Index1 = GridView2.SelectedRows[x].Index + 1;
               }
               break;
            }
         }

         foreach (GridViewDataRowInfo Vevent in GridView3.Rows)
         {

            if (GridView3.SelectedRows.Count > 0)
            {
               for (x = 0; x < GridView3.SelectedRows.Count; x++)
               {
                  Index2 = GridView3.SelectedRows[x].Index + 1;
               }
               break;
            }
         }

         foreach (GridViewDataRowInfo REvent in GridView4.Rows)
         {

            if (GridView4.SelectedRows.Count > 0)
            {
               for (x = 0; x < GridView4.SelectedRows.Count; x++)
               {
                  Index3 = GridView4.SelectedRows[x].Index + 1;
               }
               break;
            }
         }

         ConditionalFormattingObject HL_1 = new ConditionalFormattingObject("Highlighter", ConditionTypes.Equal, Index1.ToString(), "", true);
         Font newFont = new Font("Arial", 8f, FontStyle.Bold);
         HL_1.CellFont = newFont;
         HL_1.CellForeColor = Color.DarkRed;
         HL_1.RowBackColor = Color.Gold;

         ConditionalFormattingObject HL_2= new ConditionalFormattingObject("Highlighter", ConditionTypes.Equal, Index2.ToString(), "", true);
         Font newPBVFont = new Font("Arial", 8f, FontStyle.Bold);
         HL_2.CellFont = newPBVFont;
         HL_2.CellForeColor = Color.DarkRed;
         HL_2.RowBackColor = Color.Gold;


         ConditionalFormattingObject HL_3 = new ConditionalFormattingObject("Highlighter", ConditionTypes.Equal, Index3.ToString(), "", true);
         Font newRVFont = new Font("Arial", 8f, FontStyle.Bold);
         HL_3.CellFont = newRVFont;
         HL_3.CellForeColor = Color.DarkRed;
         HL_3.RowBackColor = Color.Gold;

         ConditionalFormattingObject No_HL = new ConditionalFormattingObject("No Highlighter", ConditionTypes.Equal, MIDindex, "", true);
         Font newUMCFont = new Font("Arial", 8f, FontStyle.Regular);
         No_HL.CellFont = newUMCFont;
         No_HL.RowBackColor = Color.White;
         No_HL.CellForeColor = Color.Black;

         if (Index1 > Index2 && Index1 > Index3)
         {
            MainGridView.Columns["Column1"].ConditionalFormattingObjectList.Add(HL_1);

            GridView2.ClearSelection();
         }

         else if (Index2 > Index1 && Index2 > Index3)
         {
            MainGridView.Columns["column2"].ConditionalFormattingObjectList.Add(HL_2);

            GridView3.ClearSelection();
         }

         else if (Index3 > Index1 && Index3 > Index2)
         {
            MainGridView.Columns["Column3"].ConditionalFormattingObjectList.Add(HL_3);

            GridView4.ClearSelection();
         }
         else if (MIDindex != null && MID > Index1 && MID > Index2 && MID > Index3)
         {
            Index1 = -1;
            Index2 = -1;
            Index3 = -1;

            MainGridView.Columns["Column0"].ConditionalFormattingObjectList.Add(No_HL);
            

            MainGridView.ClearSelection();
            MainGridView.Refresh();
         }
         return;
      }

 

I Feel as though there must be a much easier way to do this.

Thanks.

David
Top achievements
Rank 1
 answered on 27 Jan 2020
2 answers
729 views

Hi,

I have a grouped radgridview.

What I am trying to accomplish is, when a regular (not group row) row is selected, I would like to change the background color of it's group row so it will be easy to see it (the group row of the selected regular row).

For example - 

Group Row A

1

2

3

Group Row B

4

5

if the user selects the row "2" I want "Group Row A" to change color. If the user then selects row "4" I want "Group row B" to change color (and "Group Row A" to change back to it's default color).

 

I have succeeded to change the color of the group row when selecting the group row directly (through the ViewRowFormatting event) but can not do it in a good way when a regular row is selected (in the SelectionChnaged event). I tried using:

1) From SelectionChanged event calling  this.gridView.TableElement.Update(GridUINotifyAction.Reset) but it brings the table back to the top if the user scrolled down.

2) From SelectionChanged  - tried to get the group row of the selected row and change it's background. Can not find the way to get to the GroupRowElement where I can access the background property.

Please help, any advice to achieve this would be appreciated!

Yaron

 

 

n/a
Top achievements
Rank 1
 answered on 27 Jan 2020
1 answer
331 views

hello i'm using radchat on my project and i have two questions

one

I've read how to sending a image but i'm not sure how i can send other files like Audio,video...

 

ChatMediaMessage mediaMessage = new ChatMediaMessage(img, new Size(300, 200), null, Chat_Box.Author, DateTime.Now);

 

two

and also are some of them like video types going to have a preview in the radchat like the image or not

if not how i can access the file that radchat is showing to execute it example like this Process.Start("C:\\");

thank you 

 

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 27 Jan 2020
1 answer
493 views
I have 80 email addresses separated with comma in a textbox. I also have four empty textboxes. How can I share the 80 email addresses equally among the four textboxes? I have not tried any thing because I no idea on how to start.
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 27 Jan 2020
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
DropDownList
Buttons, RadioButton, CheckBox, etc
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Form
Chart (obsolete as of Q1 2013)
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
VirtualGrid
Toolstrip (obsolete as of Q3 2010)
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
SplitContainer
Documentation
Map
DesktopAlert
CheckedDropDownList
ProgressBar
MessageBox
TrackBar
Rotator
SpinEditor
CheckedListBox
StatusStrip
CollapsiblePanel
LayoutControl
ShapedForm
SyntaxEditor
Wizard
TextBoxControl
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
WaitingBar
GroupBox
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
NavigationView
BindingNavigator
RibbonForm
Styling
Barcode
PopupEditor
TaskBoard
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Overlay
Security
LocalizationProvider
Dictionary
TreeMap
StepProgressBar
SplashScreen
Flyout
Separator
SparkLine
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
SpeechToTextButton
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?