Friday, 1 March 2013
how to make single radio button selection in gridview using javascript
By: Suresh Dasari Dec 20, 2010
Categories: Asp.net, Gridview, Javascript Introduction
Here I will explain how to make single radio button selection in gridview using javascript.
Description
In my application I have designed gridview with radio button after completion of all the functionality if try to select radio button I am able to select all the radio buttons in gridview that is like this
My requirement is to make single radio button selection in gridview for that I have written JavaScript function to maintain single radio button selection in gridview. To implement this first design your aspx page like this
Grdview with Arraylist
In code behind bind your gridview and check it
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGridviewData();
}
}
protected void BindGridviewData()
{
SqlConnection con = new SqlConnection("Data Source=MYSystem;Initial Catalog=MySamplesDB;Integrated Security=True");
con.Open();
SqlCommand cmd = new SqlCommand("select UserId,UserName,FirstName,LastName,Location from User_Information", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
gvdata.DataSource = ds;
gvdata.DataBind();
con.Close();
}
Demo
Thursday, 28 February 2013
SQL SERVER – Find First Day of Any Month – Current Previous Next
--FirstDay_PreviousMonth
SELECT DATEADD(mm, DATEDIFF(m,0,getdate())-1,0)
--FirstDay_CurrentMonth
SELECT DATEADD(mm, DATEDIFF(m,0,getdate()),0)
--FirstDay_NextMonth
SELECT DATEADD(mm, DATEDIFF(m,0,getdate())+1,0)
SQL SERVER – Find Last Day of Any Month – Current Previous Next
----Last Day of Previous Month
SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0))
LastDay_PreviousMonth
----Last Day of Current Month
SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+1,0))
LastDay_CurrentMonth
----Last Day of Next Month
SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+2,0))
Tuesday, 26 February 2013
Friday, 15 February 2013
Table rows and column count in sql server query
CREATE TABLE #temp
(
table_name sysname ,
row_count INT,
reserved_size VARCHAR(50),
data_size VARCHAR(50),
index_size VARCHAR(50),
unused_size VARCHAR(50))
SET NOCOUNT ON
INSERT #temp EXEC sp_msforeachtable 'sp_spaceused ''?'''
SELECT a.table_name,a.row_count,COUNT(*) AS col_count FROM #temp a
INNER JOIN information_schema.columns b
ON a.table_name collate database_default
= b.table_name collate database_default
GROUP BY a.table_name, a.row_count
DROP TABLE #temp
SQL Server database details
how many table and rows to be display
DECLARE @TableRowCounts TABLE ([TableName] VARCHAR(128), [RowCount] INT)
INSERT INTO @TableRowCounts ([TableName], [RowCount])
EXEC sp_MSforeachtable 'SELECT ''?'' [TableName], COUNT(*) [RowCount] FROM ?'
SELECT [TableName], [RowCount]
FROM @TableRowCounts
ORDER BY [TableName]
Subscribe to:
Posts (Atom)