hey,

i m working on Asp.net with C#
i made a table which has username, CheckIntime, Checkouttime and Date in a grid view
i want that customer enter his name in text box and click the submit button then it display his data in table on web page

i do the the coding like this can u plz help me and tell me how can i do 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.Sql;
using System.Data.SqlClient;
using System.Configuration;

namespace manage_logs
{
    public partial class UserView : System.Web.UI.Page
    {



        protected void Page_Load(object sender, EventArgs e)
        {
            // GridView1.Visible = false;

        }


        protected void Button1_Click(object sender, EventArgs e)
        {

            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
            SqlCommand cmd = new SqlCommand("select * from [Logs] where name = '" + TextBox1.Text + "'", conn);
            //SqlDataReader reader;

            conn.Open();
            try
            {
                SqlParameter Username = new SqlParameter();
                Username.ParameterName = "@TextBox1.Text";
                Username.Value = TextBox1.Text.Trim();
                cmd.Parameters.Add(Username);
                SqlDataReader dr = cmd.ExecuteReader();
                DataTable dt = new DataTable();
                dt.Load(dr);
                GridView1.DataSource = dt;
                GridView1.DataBind();
                SqlParameter search = new SqlParameter();

            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
            finally
            {
                //Connection Object Closed
                conn.Close();
            }
        }
    }
}

Recommended Answers

All 28 Replies

Something like this would work.

protected void Button1_Click(object sender, EventArgs e)
    {
        
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
        SqlCommand cmd = new SqlCommand("select * from [Logs] where name = @Username", conn);
        try
        {
            using (conn)
            {
            conn.Open();
                SqlParameter Username = new SqlParameter();
                Username.ParameterName = "@Username";
                Username.SqlDbType = System.Data.SqlDbType.varchar
                Username.Value = TextBox1.Text.Trim();
                cmd.Parameters.Add(Username);
                GridView1.DataSource = cmd.ExecuteReader();
                GridView1.DataBind();
            }

        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
    }
}

I switched out the finally for a using and had the datasource use the reader directly as well. I also made it so the query actually uses the parameter you were using.

As for the gridview make sure the field names are actually set up. For an example look below.

<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:BoundField DataField="Fieldname Here" />
</Columns>
</asp:GridView>

Also since the sql statement uses = insted of like whatever is in the textbox will need to match the name column in the database exactly

it give error


Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1061: 'ASP.categoryview_userview_aspx' does not contain a definition for 'TextBox1_TextChanged' and no extension method 'TextBox1_TextChanged' accepting a first argument of type 'ASP.categoryview_userview_aspx' could be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 19: </div>
Line 20: <p>
Line 21: <asp:TextBox ID="TextBox1" runat="server"
Line 22:
Line 23: style="z-index: 1; left: 258px; top: 55px; position: absolute; height: 27px"

This is my source view

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserView.aspx.cs" Inherits="manage_logs.UserView" %>

<!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>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        UserView<br />
        <br />
        <asp:Label ID="Label1" runat="server" 
            style="z-index: 1; left: 96px; top: 58px; position: absolute" 
            Text="EnterUserName"></asp:Label>
    
    </div>
    <p>
        <asp:TextBox ID="TextBox1" runat="server" 
            
            style="z-index: 1; left: 258px; top: 55px; position: absolute; height: 27px" 
            OnTextChanged="TextBox1_TextChanged"></asp:TextBox>
    </p>
    <asp:Button ID="Button1" runat="server" 
        style="z-index: 1; left: 256px; top: 108px; position: absolute" 
        Text="Submit" onclick="Button1_Click" />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="UserName" DataSourceID="SqlDataSource1" 
        EnableModelValidation="True" 
        style="z-index: 1; left: 71px; top: 303px; position: absolute; height: 42px; width: 7px">
        <Columns>
            <asp:BoundField DataField="UserName" HeaderText="UserName" ReadOnly="True" 
                SortExpression="UserName" />
            <asp:BoundField DataField="CheckinTime" HeaderText="CheckinTime" 
                SortExpression="CheckinTime" />
            <asp:BoundField DataField="CheckoutTime" HeaderText="CheckoutTime" 
                SortExpression="CheckoutTime" />
            <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        SelectCommand="SELECT * FROM [Logs]"></asp:SqlDataSource>
    <asp:GridView ID="GridView2" runat="server" 
        style="z-index: 1; left: 448px; top: 209px; position: absolute; height: 137px; width: 48px; margin-top: 0px">
    </asp:GridView>
    </form>
</body>
</html>

Get rid of the OnTextChanged="TextBox1_TextChanged" in the asp:textbox clientside since there is no corresponding server side method.

like that but gives error text box does not exit

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserView.aspx.cs" Inherits="manage_logs.UserView" %>

<!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>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        UserView<br />
        <br />
        <asp:Label ID="Label1" runat="server" 
            style="z-index: 1; left: 96px; top: 58px; position: absolute" 
            Text="EnterUserName"></asp:Label>
    
    </div>
    <p>
        <asp:TextBox ID="TextBox1" runat="server" 
            
            style="z-index: 1; left: 258px; top: 55px; position: absolute; height: 27px" 
            </asp:TextBox>
    </p>
    <asp:Button ID="Button1" runat="server" 
        style="z-index: 1; left: 256px; top: 108px; position: absolute" 
        Text="Submit" onclick="Button1_Click" />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="UserName" DataSourceID="SqlDataSource1" 
        EnableModelValidation="True" 
        style="z-index: 1; left: 71px; top: 303px; position: absolute; height: 42px; width: 7px">
        <Columns>
            <asp:BoundField DataField="UserName" HeaderText="UserName" ReadOnly="True" 
                SortExpression="UserName" />
            <asp:BoundField DataField="CheckinTime" HeaderText="CheckinTime" 
                SortExpression="CheckinTime" />
            <asp:BoundField DataField="CheckoutTime" HeaderText="CheckoutTime" 
                SortExpression="CheckoutTime" />
            <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        SelectCommand="SELECT * FROM [Logs]"></asp:SqlDataSource>
    <asp:GridView ID="GridView2" runat="server" 
        style="z-index: 1; left: 448px; top: 209px; position: absolute; height: 137px; width: 48px; margin-top: 0px">
    </asp:GridView>
    </form>
</body>
</html>

<asp:TextBox ID="TextBox1" runat="server"
style="z-index: 1; left: 258px; top: 55px; position: absolute; height: 27px">
</asp:TextBox>

Use that, you accidently deleted the closing tag for the textbox. The last > on the second line.

its running but its not giving me data it gives an error like invalid column name when i click submit button

Also, didn't notice this until you posted the html but since you already have a sqldatasource assigned to the gridview that will automatically be databound everytime. You will want to get rid of that and instead bind it server side.
You can put this either in the page load itself. Also to fix the wrong column error I changed name to username in the query select statement. I will post everything below.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserView.aspx.cs" Inherits="manage_logs.UserView" %>

<!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 id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>

UserView<br />
<br />
<asp:Label ID="Label1" runat="server"
style="z-index: 1; left: 96px; top: 58px; position: absolute"
Text="EnterUserName"></asp:Label>

</div>
<p>
<asp:TextBox ID="TextBox1" runat="server"
style="z-index: 1; left: 258px; top: 55px; position: absolute; height: 27px"></asp:TextBox>
</p>
<asp:Button ID="Button1" runat="server"
style="z-index: 1; left: 256px; top: 108px; position: absolute"
Text="Submit" onclick="Button1_Click" />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="UserName" 
EnableModelValidation="True"
style="z-index: 1; left: 71px; top: 303px; position: absolute; height: 42px; width: 7px">
<Columns>
<asp:BoundField DataField="UserName" HeaderText="UserName" ReadOnly="True"
SortExpression="UserName" />
<asp:BoundField DataField="CheckinTime" HeaderText="CheckinTime"
SortExpression="CheckinTime" />
<asp:BoundField DataField="CheckoutTime" HeaderText="CheckoutTime"
SortExpression="CheckoutTime" />
<asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
</Columns>
</asp:GridView>
<asp:GridView ID="GridView2" runat="server"
style="z-index: 1; left: 448px; top: 209px; position: absolute; height: 137px; width: 48px; margin-top: 0px">
</asp:GridView>
</form>
</body>
</html> 

Code:

    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
        SqlCommand cmd = new SqlCommand("select * from [Logs]", conn)   
        using (conn)
        {
        conn.Open();
        GridView1.DataSource = cmd.ExecuteReader();
        GridView1.DataBind();
        }
    }

protected void Button1_Click(object sender, EventArgs e)
{

SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand("select * from [Logs] where Username = @Username", conn);
try
{
using (conn)
{
conn.Open();
SqlParameter Username = new SqlParameter();
Username.ParameterName = "@Username";
Username.SqlDbType = System.Data.SqlDbType.varchar
Username.Value = TextBox1.Text.Trim();
cmd.Parameters.Add(Username);
GridView1.DataSource = cmd.ExecuteReader();
GridView1.DataBind();
}

}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}

It will be bound twice on postback but for simplicities sake we will forgo efficiency right now. :)
Let me know if it throws anymore errors.

my c # code:-

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.Sql;
using System.Data.SqlClient;
using System.Configuration;

namespace manage_logs
{
    public partial class UserView : System.Web.UI.Page
    {



        protected void Page_Load(object sender, EventArgs e)
        {
             GridView1.Visible = false;

        }



       protected void Button1_Click(object sender, EventArgs e)
{

SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand("select * from [Logs] where name = @Username", conn);
try
{
using (conn)
{
conn.Open();
SqlParameter Username = new SqlParameter();
Username.ParameterName = "@Username";
Username.SqlDbType = System.Data.SqlDbType.VarChar;
Username.Value = TextBox1.Text.Trim();
cmd.Parameters.Add(Username);
GridView1.DataSource = cmd.ExecuteReader();
GridView1.DataBind();
GridView1.Visible = true;
}

}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
}
    }


       
MY source code 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserView.aspx.cs" Inherits="manage_logs.UserView" %>

<!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>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        UserView<br />
        <br />
        <asp:Label ID="Label1" runat="server" 
            style="z-index: 1; left: 96px; top: 58px; position: absolute" 
            Text="EnterUserName"></asp:Label>
    
    </div>
   
    <asp:Button ID="Button1" runat="server" 
        style="z-index: 1; left: 256px; top: 108px; position: absolute" 
        Text="Submit" onclick="Button1_Click" />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="UserName" DataSourceID="SqlDataSource1" 
        EnableModelValidation="True" 
        
        style="z-index: 1; left: 71px; top: 226px; position: absolute; height: 42px; width: 7px">
        <Columns>
            <asp:BoundField DataField="UserName" HeaderText="UserName" ReadOnly="True" 
                SortExpression="UserName" />
            <asp:BoundField DataField="CheckinTime" HeaderText="CheckinTime" 
                SortExpression="CheckinTime" />
            <asp:BoundField DataField="CheckoutTime" HeaderText="CheckoutTime" 
                SortExpression="CheckoutTime" />
            <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        SelectCommand="SELECT * FROM [Logs]"></asp:SqlDataSource>
    <asp:TextBox ID="TextBox1" runat="server" 
        style="z-index: 1; left: 239px; top: 52px; position: absolute"></asp:TextBox>
    <asp:GridView ID="GridView2" runat="server" 
        style="z-index: 1; left: 448px; top: 209px; position: absolute; height: 137px; width: 48px; margin-top: 0px">
    </asp:GridView>
    </form>
</body>
</html>

THanks You So Much <3....

See my post right before you posted. You can probably add the GridView1.Visible = false; to the pageload again since I accidently removed that.

one more thing
suppose i have same table like the previous one now i want that user can select a stat date and end date from the calender and it will check into the database display the data like the previous one

my source view

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ViewLog.aspx.cs" Inherits="manage_logs._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></title>
    </head>
<body>
    <form id="form1" runat="server">
    <p>
        Manage Logs ( View Log)</p>
    <p>
        &nbsp;</p>
    <p>
        &nbsp;</p>
    <p>
        <asp:Label ID="Label2" runat="server" 
            style="z-index: 1; left: 231px; top: 123px; position: absolute; height: 19px; width: 81px" 
            Text="Start Date"></asp:Label>
    </p>
    <p>
        &nbsp;</p>
    <asp:Calendar ID="Calendar1" runat="server" 
        style="z-index: 1; left: 351px; top: 32px; position: absolute; height: 205px; width: 9px">
    </asp:Calendar>
    <p>
        &nbsp;</p>
    <p>
        &nbsp;</p>
    <asp:Calendar ID="Calendar2" runat="server" 
        onselectionchanged="Calendar2_SelectionChanged" 
        style="z-index: 1; left: 348px; top: 260px; position: absolute; height: 205px; width: 9px">
    </asp:Calendar>
    <p>
        <asp:Label ID="Label3" runat="server" 
            style="z-index: 1; left: 232px; top: 288px; position: absolute" Text="End Date"></asp:Label>
    </p>
    <p>
        &nbsp;</p>
    <p>
        &nbsp;</p>
    <p>
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click1" 
            style="z-index: 1; left: 303px; top: 522px; position: absolute; height: 26px; width: 91px; margin-bottom: 62px" 
            Text="Submit" />
    </p>
    <p>
        &nbsp;</p>
    </form>
</body>
</html>

my code

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


namespace manage_logs
{
    public partial class _Default : System.Web.UI.Page
    {
        //StreamReader myReader = new StreamReader("logfile");

          
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        {

        }

        protected void Calendar1_SelectionChanged(object sender, EventArgs e)
        {
           
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
        

        }

        protected void Calendar2_SelectionChanged(object sender, EventArgs e)
        {

        }

        protected void Button1_Click1(object sender, EventArgs e)
        {
            

        }

        protected void Calendar1_SelectionChanged1(object sender, EventArgs e)
        {

        }
       

    }
}

i got it the previous problem

Thanks

Assuming you want exact dates on the check in time and check out time you can use the following for button1_click

protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand("select * from [Logs] where CheckInTime = @CheckInTime and CheckOutTime = @CheckOutTime", conn);
try
{
using (conn)
{
conn.Open();
SqlParameter param1 = new SqlParameter();
param1.ParameterName = "@CheckInTime";
param1e.SqlDbType = System.Data.SqlDbType.Datetime;
param1.Value = calender1.SelectedDate;
cmd.Parameters.Add(param1);
param2 = new SqlParameter();
param2.ParameterName = "@CheckOutTime";
param2.SqlDbType = System.Data.SqlDbType.Datetime;
param2.Value = calender2.SelectedDate;
cmd.Parameters.Add(param2);
GridView1.DataSource = cmd.ExecuteReader();
GridView1.DataBind();
}

}
catch (Exception ex)
{
Response.Write(ex.Message);
}

}

hi

it give an error

Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1061: 'ASP.viewlog_viewlog_aspx' does not contain a definition for 'Calendar1_SelectionChanged1' and no extension method 'Calendar1_SelectionChanged1' accepting a first argument of type 'ASP.viewlog_viewlog_aspx' could be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 40: SelectCommand="SELECT * FROM [Logs]"></asp:SqlDataSource>
Line 41: </p>
Line 42: <asp:Calendar ID="Calendar1" runat="server"
Line 43:
Line 44: style="z-index: 1; left: 351px; top: 32px; position: absolute; height: 205px; width: 9px"


Source File: c:\Users\Rahul\Documents\Visual Studio 2010\Projects\manage logs\manage logs\ViewLog\ViewLog.aspx Line: 42


Show Detailed Compiler Output:

C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0> "C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe" /t:library /utf8output /R:"C:\Windows\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.WorkflowServices\3.5.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll" /R:"C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\dc4d45d2\ffce7b0a\assembly\dl3\51530a2a\8c3ac1c2_4005cc01\manage logs.DLL" /R:"C:\Windows\assembly\GAC_MSIL\System.Xml.Linq\3.5.0.0__b77a5c561934e089\System.Xml.Linq.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.IdentityModel\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.ServiceModel.Web\3.5.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"C:\Windows\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Data.DataSetExtensions\3.5.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll" /R:"C:\Windows\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Web.Extensions\3.5.0.0__31bf3856ad364e35\System.Web.Extensions.dll" /out:"C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\dc4d45d2\ffce7b0a\App_Web_gise2lye.dll" /D:DEBUG /debug+ /optimize- /w:4 /nowarn:1659;1699;1701 /warnaserror- "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\dc4d45d2\ffce7b0a\App_Web_gise2lye.0.cs" "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\dc4d45d2\ffce7b0a\App_Web_gise2lye.1.cs"


Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.4926
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.

c:\Users\Rahul\Documents\Visual Studio 2010\Projects\manage logs\manage logs\ViewLog\ViewLog.aspx(42,70): error CS1061: 'ASP.viewlog_viewlog_aspx' does not contain a definition for 'Calendar1_SelectionChanged1' and no extension method 'Calendar1_SelectionChanged1' accepting a first argument of type 'ASP.viewlog_viewlog_aspx' could be found (are you missing a using directive or an assembly reference?)
c:\Users\Rahul\Documents\Visual Studio 2010\Projects\manage logs\manage logs\ViewLog\ViewLog.aspx(42,70): error CS1061: 'ASP.viewlog_viewlog_aspx' does not contain a definition for 'Calendar1_SelectionChanged1' and no extension method 'Calendar1_SelectionChanged1' accepting a first argument of type 'ASP.viewlog_viewlog_aspx' could be found (are you missing a using directive or an assembly reference?)
c:\Users\Rahul\Documents\Visual Studio 2010\Projects\manage logs\manage logs\ViewLog\ViewLog.aspx(51,70): error CS1061: 'ASP.viewlog_viewlog_aspx' does not contain a definition for 'Calendar2_SelectionChanged' and no extension method 'Calendar2_SelectionChanged' accepting a first argument of type 'ASP.viewlog_viewlog_aspx' could be found (are you missing a using directive or an assembly reference?)
c:\Users\Rahul\Documents\Visual Studio 2010\Projects\manage logs\manage logs\ViewLog\ViewLog.aspx(51,70): error CS1061: 'ASP.viewlog_viewlog_aspx' does not contain a definition for 'Calendar2_SelectionChanged' and no extension method 'Calendar2_SelectionChanged' accepting a first argument of type 'ASP.viewlog_viewlog_aspx' could be found (are you missing a using directive or an assembly reference?)


Show Complete Compilation Source:

Get rid of the onselectionchanged for that control in the source view.

i already delete it not showing from the start date to end date.. it shing the whole table

Make sure you are also databinding in the page_load again and not using a sqldatasource on the page since that will result in it always showing everything unless you filter it.

i wondering about my data type in table for CheckIntime and CheckOuttime i used time(7)
for date i use date is it fine becoz it running but gives error like

"the data types time and datetime are incompatible in the equal to operator"

yeah you will want to change the parameter datatype then to time instead of datetime.

for both i mean checkIntime Checkout time and date i have to use time datatype

yeah when using the parameters in the button1_click method switch the datetypes to time instead of datetime. You can leave the date as date.

Guys!

Read forum rules.

Wrap your programming code blocks within

[code]

....

[/code]

tags.

Sorry about that i will post according to forum rules

now it gives error "Failed to convert parameter value from a DateTime to a TimeSpan"

actually i am searching the data according to "date" not "time" like i have a table in which some user "login" into the system on different dates so i want to select the start date and end date from two different calenders and display the data from the start date to the end date according to the date which i selected...

@rahigoswami

It's all right. I appreciate your spirit. Enjoy posting.

now it gives error "Failed to convert parameter value from a DateTime to a TimeSpan"

actually i am searching the data according to "date" not "time" like i have a table in which some user "login" into the system on different dates so i want to select the start date and end date from two different calenders and display the data from the start date to the end date according to the date which i selected

Hi Rahi,

After entering the name in the textbox call a AJAX method onblur or onfocus out of the textbox and pass the entered text to the AJAX method and code behind call use webmethod which will connect to DB and Fetchs the Result according to the text. and display the returned recorded in grid or textarea where u want .. If feel any diffuculty in doing this please reply to this i can suggest u more on this

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.