<%@ Page Title="Admin home" Language="C#" MasterPageFile="~/master.Master" AutoEventWireup="true" CodeBehind="adminhome.aspx.cs" Inherits="ApComapaign.adminhome" %>
name:
ControlToValidate="txtname" ErrorMessage="*" ForeColor="#FF0066">
password:
ErrorMessage="*" ForeColor="#FF0066">
i have a code like this and button click is not firing in thhis code can any one help me
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jul 25, 2013, 11:52 PM EDT
aditya immadi186 reputationPosted Jul 26, 2013, 12:18 AM EDT
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;
namespace ApComapaign
{
public partial class adminhome : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnlogin_Click(object sender, EventArgs e)
{
string constring = ConfigurationManager.ConnectionStrings["conn"].ToString();
SqlCommand cmd = new SqlCommand();
SqlConnection conn = new SqlConnection(constring);
cmd.Connection = conn;
conn.Open();
cmd.CommandText = "spadmin1";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("name", txtname.Text);
cmd.Parameters.AddWithValue("password", txtpwd.Text);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
if (ds != null && ds.Tables.Count > 0)
{
string status = ds.Tables[0].Rows[0][0].ToString();
if (status == "yes")
{
Session["name"] = ds.Tables[1].Rows[0]["name"].ToString();
Session["password"] = ds.Tables[1].Rows[0]["password"].ToString();
Response.Redirect("adminhome.aspx");
}
else
{
lblmsg.Text = "ivalid credentials";
}
}
}
}
}
Thanks and Regards
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jul 26, 2013, 12:33 AM EDT
i checked your code its working fine.
if the problem persists then delete the button and place a new one. and write the event for new one.
aditya immadi186 reputationPosted Jul 26, 2013, 12:40 AM EDT
can you have another solution .because my total work is depends on this one
thanks and regards
Pankaj PandeyRank #642 · 3.7K reputationPosted Jul 26, 2013, 12:41 AM EDT
by
and try again
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jul 26, 2013, 12:43 AM EDT
aditya immadi186 reputationPosted Jul 26, 2013, 12:45 AM EDT
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="master.master.cs" Inherits="ApComapaign.master" %>
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jul 26, 2013, 12:53 AM EDT
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="master.master.cs" Inherits="ApComapaign.master" %>
use this masterpage to create child page:
when you create child page two contentplaceholder will come:
write your code within 2nd content placeholder.
ex:-
your javascript code and css
your body content
aditya immadi186 reputationPosted Jul 26, 2013, 1:29 AM EDT
The page has one or more
correct the problem in code view:
head
this is my new page source code
<%@ Page Title="" Language="C#" MasterPageFile="~/master.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="ApComapaign.WebForm1" %>
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 26, 2013, 1:37 AM EDT
Is your button event is not firing or inside the event handler the code is not getting executed? can you put the break point in below line and check
protected void btnlogin_Click(object sender, EventArgs e)
{
Regards,
Iftikar
aditya immadi186 reputationPosted Jul 26, 2013, 1:42 AM EDT
aditya immadi186 reputationPosted Jul 26, 2013, 2:10 AM EDT
Thanks and Regards
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jul 26, 2013, 2:17 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 26, 2013, 2:51 AM EDT
Regards,
Iftikar
aditya immadi186 reputationPosted Jul 28, 2013, 3:35 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 28, 2013, 3:39 AM EDT
Regards,
Iftikar
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts