Posts

Showing posts with the label Bind data

Add radio button control to Grid View and make only one selected radio button using JavaScript in Asp.net, C#

Image
In this blog, I am going to show how to add radio button to the gridview and only one radio button selection at a time using JavaScript. First of all, add the below javascript code inside your <head> tag which is responsible for only single readio button selected ::     <style type="text/css"> .Gridview { font-family:Verdana; font-size:10pt; font-weight:normal; color:black; width:300px; border-color:black; } </style> <script language="javascript" type="text/javascript">     function SelectSingleRadiobutton(rdbtnid) {         var rdBtn = document.getElementById(rdbtnid);         var rdBtnList = document.getElementsByTagName("input");         for (i = 0; i < rdBtnList.length; i++) {             if (rdBtnList[i].type == "radio" && rdBtnList[i].id != rdBtn.id) {                 rdBtn...

Show GridView row details in tooltip on mouseover with jQuery using asp.net inside GridView in c#

Image
In this blog i am going to explain how to show gridview row details in tooltip on mouseover with jQuery using asp.net in C# First of all in the design page(.aspx) write place Gridview as following:: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="GridViewToolTipaspx.aspx.cs" Inherits="GridViewToolTipaspx" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title>     <script src="http://code.jquery.com/jquery-1.8.2.js" type="text/javascript"></script> <script src="js/jquery.tooltip.min.js" type="text/javascript"></script> <script type="text/javascript">     function InitializeToolTip() {         $(".gridViewTool...

Fill/ Bind/ Load DropDown List with the data from the Sql Server table.

In this blog i am going to explain how to dynamically Bind/Load/Fill DropDownList with the data from the Sql Server table. First of all n the design page(.aspx) place a DropDownList control as:          <asp:DropDownList ID="ddlistQualification" runat="server" RepeatColumns="2">         </asp:DropDownList> Now Create a connectionstring in the web.config file under configuration tag as: <configuration> <connectionStrings>                                 <add name="Conn" connectionString="Data Source=.;Initial Catalog=My_DB;Integrated Security=True"/> </connectionStrings> </configuration> Now, Create a Database "My_DB" in sql server and also create a table "Qualifications" having 2 fields :          "Qualification_Id int identity(1,1) primary key not null, Qualification varchar(50)" ...

Bind data to checkbox list from database in C# (Fiil Checkbox list from table in asp.net c#)

In this blog i am going to explain how to dynamically Bind/Load/Fill CheckBoxList with the data from the Sql Server table. First of all n the design page(.aspx) place a CheckBoxList control as:          <asp:CheckBoxList ID="ckQualification" runat="server" RepeatColumns="2">         </asp:CheckBoxList> Now Create a connectionstring in the web.config file under configuration tag as: <configuration> <connectionStrings>                                 <add name="Conn" connectionString="Data Source=.;Initial Catalog=My_DB;Integrated Security=True"/> </connectionStrings> </configuration> Now, Create a Database "My_DB" in sql server and also create a table "Qualifications" having 2 fields :           "Qualification_Id int identity(1,1) primary key not null, Qualification...

Check Empty/ Null value in the Data Table and replace null values with custom value

Image
Below i have used a gridview and putted some data inside gridview containing few null values inside data columns and replacing all null values with string "Data Not Avaialable" :: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; public partial class ValueAgainstNull : System.Web.UI.Page {     protected void Page_Load(object sender, EventArgs e)     {         if (!IsPostBack)         {             BindData();         }     }     protected void BindData()     {         DataTable dt = new DataTable();         dt.Columns.Add("UserId", typeof(Int32));         dt.Columns.Add("Name", typeof(string));         dt.Columns.Add("Designation", typeof(s...
go to top image