Tuesday, September 16, 2025

Show or hide an element

 

How to show or hide an element:

In order to show or hide an element, manipulate the element's style property. In most cases, you probably just want to change the element's display property:

 
element.style.display = 'none';               // Hide
element.style.display = 'block';              // Show
element.style.display = 'inline';             // Show
element.style.display = 'inline-block';   // Show

 

 

Alternatively, if you would still like the element to occupy space (like if you were to hide a table cell), you could change the element's visibility property instead:

 
element.style.visibility = 'hidden';      // Hide
element.style.visibility = 'visible';     // Show

Thursday, February 13, 2025

Save C# DataTable SQL Server Table

Save C# DataTable SQL Server Table

 
1.    Create User Defined Data Table Type 
 
CREATE TYPE tbl_data AS TABLE
(
    InvoiceDate        NVARCHAR(50),
    InvoiceNo           VARCHAR(20),
    SKUCode           VARCHAR(10),
    ItemName          VARCHAR(50),
    Category            VARCHAR(50),
    SubCategory      VARCHAR(50) NULL,
    Qty                     INT  
 
2. Pass data stored in DataTable to a stored procedure as a parameter of type DataTable.
 
3. In stored procedure 

INSERT INTO INV_DATA (InvoiceDate, InvoiceNo, SKUCode, ItemName, Category, SubCategory, Qty)
SELECT                             InvoiceDate, InvoiceNo, SKUCode, ItemName, Category, SubCategory, Qty
FROM             @data
  

How to make an HTTP get request with parameters

 

Method-1

In a GET request, pass parameters as part of the query string.

 

                    string url = "http://inventory.com?invoice=12345";
 
Method-2
 
WebClient webClient = new WebClient();
webClient.QueryString.Add("param1", "value1");
webClient.QueryString.Add("param2", "value2");
string result = webClient.DownloadString("http://theurl.com");