Posts

Showing posts from January, 2024

Syncfusion GridControl - Create extended Custom Column Properties

Image
Syncfusion GridControl - Create extended Custom Column Properties  When you need some additional information stored. Which can used in the runtime for saving or validating. you will need to have  extended column properties. With we can some additional properties in GridControl which can be accessed in code. Such as is the column required,  Custom Error Message , DataType, Fieldname in database which will be linked to column and so on.  created a property which take information as per column index     Syncfusion GridControl is inherited and custom grid is created namespace ATS.WinForms.Controls {     public partial class Grid : GridControl     { [Description("Set Grid Column Properties"), Category("ATS")] [EditorAttribute(typeof(System.ComponentModel.Design.ArrayEditor), typeof(System.Drawing.Design.UITypeEditor))] public GridColumnProperties[] ColumnProperties {      get      { ...

Syncfusion - GridControl - FormulaCell - Formatting with Decimal

Syncfusion - GridControl - FormulaCell For Formatting FormulaCell with leading Zero when it .999 TO 0.999 grdReport.Item(CurrentRow, intCol).Format = "##,###0.000"c

Syncfusion - GridControl - Range selection for property to be applied

Syncfusion - GridControl Range selection for property to be applied  ' Create a GridStyleInfo object Dim style As GridStyleInfo = New GridStyleInfo ' Set some properties style.BackColor = Color.SkyBlue style.TextColor = Color.RosyBrown style.CellType = "TextBox" style.Text = "EssentialGrid" ' Create a GridRangeInfo object Dim range As GridRangeInfo = GridRangeInfo.Cells(1, 1, 5, 5) ' Apply the style to the range Me.GridControl1.ChangeCells(range, style, Syncfusion.Styles.StyleModifyType.Override)

Syncfusion GridControl Textbox - Restrict from pasting of the character more than maxlength

Syncfusion GridControl  Textbox Celltype Restrict from pasting of the character more than maxlength  Private Sub GridControl1_CurrentCellValidateString(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridCurrentCellValidateStringEventArgs) Handles GridControl1.CurrentCellValidateString         If (e.Text.Length > GridControl1.ColStyles(1).MaxLength) Then             e.Cancel = True         End If  End Sub Private Sub GridControl1_PasteCellText(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridPasteCellTextEventArgs) Handles GridControl1.PasteCellText         If (e.Text.Length > e.Style.MaxLength) Then             e.Cancel = True             e.Abort = False         End If     End Sub

SQL SERVER - Sequence Type in SQL With table

Sequence Type in SQL With table  SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Table_1]( [ID] [int] IDENTITY(1,1) NOT NULL, [ContinousNumber] [bigint] NULL, [name] [varchar](50) NULL,  CONSTRAINT [PK_Table_1] PRIMARY KEY CLUSTERED  ( [ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO CREATE SEQUENCE [dbo].[Sequence-20191206-124448]   AS [bigint]  START WITH 1  INCREMENT BY 1  MINVALUE -9223372036854775808  MAXVALUE 9223372036854775807  NO CACHE  GO Delete from [Table_1] --- Check working of Sequence INSERT INTO [dbo].[Table_1] ([ContinousNumber],[name]) VALUES ( NEXT VALUE FOR [Sequence-20191206-124448],'AABC') SELECT TOP (1000) [ID]       ,[ContinousNumber]       ,[name]   FROM [ACFAFEC02122019].[dbo].[Table_1] --- Reset the Sequence ALTER SEQUENCE [Sequence-...

SQL Server - Using Declare in Table value Function

Sql Server - Using Declare in Table value Function create function Func() returns @T table(ColName int) as begin           declare @Var int           set @Var = 10           insert into @T(ColName) values (@Var)           return end

Sql Server - Find Missing Number in Sequence

Sql Server - Find Missing Number in Sequence Select * from  ( SELECT Min([GPNo]) AS StartPos , Max(GPNO) as EndPos FROM [tempdb].[dbo].[Table_1] ) SRC Outer apply ( Select Top(EndPOs) Row_Number() Over (Order by Name) as RNO from Sys.columns ) X Left outer join Table_1  on Table_1.GpNo = RNO Where GPNO Is NULL

SQL SERVER - Alternative to Like Condition

SQL SERVER - Alternative to Like Condition DECLARE @Acc TABLE ( ID  int, AccountName Varchar(200) ) Insert into @Acc (ID,AccountName)  Values (1,'Switin Kotian'),(2,'Jitesh Shiyal'),(3,'Ramesh Bangera'),(4,'Shrikant Chavan'),(5,'Dipti Patil'),(6,'Bhan Asher'),(7,'Smruti Kotian') Select * From @Acc Select * From @Acc Where AccountName Like 'S%' Select * From @Acc Where CharIndex('S',AccountName) = 1 Select * From @Acc Where Left(AccountName,1) = 'S' Select * From @Acc Where SUBSTRING(AccountName,1,1) = 'S'

Sql Server - How to have Multiple IF Condition in Table Valued Functions

  How to have Multiple IF Condition in Table Valued Functions   CREATE FUNCTION  dbo.testTVF (                 @Parameter1  as varchar(2) ,                 @Parameter2 as integer ) RETURNS @mytable table (                              CountOfRecords int ) As   begin                   if (@Parameter1  ='LP' )                                 Insert into @mytable (CountOfRecords)           ...

Syncfusion GridControl Reading CellValue using Generic Function

I have been facing issue while accessing the cellValue method of GridControl. Each CellType has different way of returning the value of cell. To handle this I have developed a generic function which take few parameter and return the cell value as per Type required by user.    Public Enum CellValueReturnType         [String] = 0         [Number] = 1         [Date] = 3         [Boolean] = 4         [Time] = 5         [FormatText] = 6     End Enum     Public Shared Function GetGridCellValue( ByVal GrdCtl As ARCGridControl , ByVal RowIndex As Integer , ByVal ColIndex As Integer , ByVal ReturnType As CellValueReturnType ) As Object           Dim CellValue As Object = Nothing   ...