Tuesday 30 June 2015

textbox allow only characters javascript

textbox allow only characters javascript

button click event not firing in asp.net c#

button click event not firing in asp.net c#

This is type of issue many times occurs in asp.net. whenever button click is not execute first check your html
Is <form>   tag in page ?

Form tag must be 1 time only, otherwise your c# event is not execute.


button click event fire using javascript

button click event fire using javascript

special character not allowed validation in javascript

special character not allowed validation in javascript

Email Validation in javascript

Email Validation in javascript

remaining characters counter javascript

remaining characters counter javascript

start date greater than end date validation in javascript

start date greater than end date validation in javascript
end date greater than start date javascript validation

how to write javascript code in c#

how to write javascript code in c#

set placeholder using javascript

set placeholder using javascript

Bind Gridview from XML File

Bind Gridview from XML File

Friday 26 June 2015

open url in new window using javascript

if you want to open page or new url  in new tab or new window using javascript code then you have to use window object in your javascript code.

wimdow.open() method use to open url in new window.


Other Articles - Step by step solution

------------------------------------------------------------------------
three tier architecture in asp.net
how to connect MS access in asp.net
how to access website in LAN
------------------------------------------------------------------------

It's solution for



=> Open URL in new tab using javascript        
=> Open URL in same tab using javascript
=> Open URL in new window using javascript
=> Open URL in new window with custom size using javascript

var MyUrl = "http://problemaspdotnet.blogspot.in";

window.open(MyUrl);

window.open(MyUrl, "_blank");

window.open(MyUrl, "_parent");

window.open(MyUrl, "_self");

window.open(MyUrl, "_top");

window.open(MyUrl, "_blank", "toolbar=yes, scrollbars=yes, resizable=yes, top=200, left=100, width=150, height=150");

Tuesday 16 June 2015

How to bind CheckBoxList from database

Here I will explain how to bind CheckBoxList from database
and in previous I posted this articles

How to bind DropdownList from database
how to access asp.net website in LAN
how to create database from script file

Checkboxlist is group of checkbox. You can check multiple item in CheckBoxList control in asp.net.
If item list is too more than use the DropDownList .

If you want to bind CheckBoxList from database table then you write following code in your website.
First , Your .aspx page should be like this

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!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> How to bind CheckBoxList from database </title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:CheckBoxList ID="chkType" runat="server">
            </asp:CheckBoxList>
      
    </div>
    </form>
</body>
</html>



And your code behind like this

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class _Default : System.Web.UI.Page
{
    SqlConnection cn;
    DataTable dt;
    protected void Page_Load(object sender, EventArgs e)
    {
        cn = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
        if (!IsPostBack)
        {
            BindCheckBoxList();
        }

    }
    public void BindCheckBoxList()
    {
        SqlCommand cmd = new SqlCommand("SELECT id,Name from tbl",cn);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        dt = new DataTable();
        da.Fill(dt);

        chkType.DataSource = dt;
        chkType.DataTextField = "Name";
        chkType.DataValueField = "Id";
        chkType.DataBind();
    }
}




How to bind DropdownList from database


Here I will explain how to bind DropdownList from database
and in previous I posted this articles
how to access asp.net website in LAN
how to create database from script file
paging in html table using javascript

If you want to bind DropdownList from database table then you write following code in your website.


First , Your .aspx page should be like this



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!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> How to bind DropdownList from database </title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        Select: <asp:DropDownList ID="ddlType" runat="server">
        </asp:DropDownList>
    </div>
    </form>
</body>
</html>

And your C# code behind like this



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class _Default : System.Web.UI.Page
{
    SqlConnection cn;
    DataTable dt;
    protected void Page_Load(object sender, EventArgs e)
    {
        cn = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
        if (!IsPostBack)
        {
            BindDropdwnlist();
        }

    }
    public void BindDropdwnlist()
    {
        SqlCommand cmd = new SqlCommand("SELECT id,Name from tbl",cn);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        dt = new DataTable();
        da.Fill(dt);

        ddlType.DataSource = dt;
        ddlType.DataTextField = "Name";
        ddlType.DataValueField = "Id";
        ddlType.DataBind();
    }
}

how to access asp.net website in LAN

how to access asp.net website in LAN

Introduction:

Here I will explain how to access asp.net website or application in LAN. If you want to access asp.net website in LAN then do following step and you can access asp.net website, project or application in LAN. to access asp.net project in another pc which is connected in LAN. Actually one user of my blog reader has asked me solution for this" access  project on any to the any PC using local IP address " application.

we can access the asp.net website or project in LAN 

So, Now I explaining how to create chat application in asp.net using c# with WebSocket.

Description: 

In previously post I explained to  
Three tier architecture in asp.net
Remove .aspx from url in asp.net
how to create chat application in asp.net using c#
Change the column name or datatype or size in sql server
upload or publish web-site
Calling web service without adding web reference

Solution

 

Step 1: Fitst open your local server and go to IIS

Step 2: Create application or website in IIS

Step 3: and go to Start=>Run=>cmd=> ipconfig   - enter this command for get IP address ,
            take IPV4 address.

Step 4: Access the web site from another pc which is connected in LAN,
            you can use like this

    http://server-IPV4-Address/MyProjetName/MyPageName.aspx        OR
    http://server-Name/MyProjetName/MyPageName.aspx

Example:    

 

    http://105.105.105.105/problemaspdotnet/Home.aspx  
    http://MyServer/problemaspdotnet/Home.aspx    

Note:

  You can not use above in outside the LAN , only access in your LAN.





Asp.net tutorials