Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8438225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:39:05+00:00 2026-06-10T07:39:05+00:00

In my project i have request page that contain a datalist with four templates

  • 0

In my project i have request page that contain a datalist with four templates Image(profilepic),Label(firstname), and Button1(accept), button2(deny) and a hidden field that contains the address of requester
And written the code
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{

    if (e.CommandName == "Accept")
    {
        SqlConnection con = new System.Data.SqlClient.SqlConnection();
        con.ConnectionString = ConfigurationManager.ConnectionStrings["Con"].ConnectionString;
        con.Open();
        if (con.State == ConnectionState.Open)
        {
            HiddenField hd = (HiddenField)e.Item.FindControl("HiddenField1");
            string str = hd.Value;
            SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
            cmd.CommandText = "Update requests set frnshpstatus='Y' where Email='" + Session["UserName"] + "' And frnemail='" + str + "'";
            cmd.Connection = con;
            cmd.CommandType = CommandType.Text;
            cmd.ExecuteNonQuery();

        }
    }
    else if (e.CommandName == "Deny")
    {
        SqlConnection con = new System.Data.SqlClient.SqlConnection();
        con.ConnectionString = ConfigurationManager.ConnectionStrings["Con"].ConnectionString;
        con.Open();
        if (con.State == ConnectionState.Open)
        {
            HiddenField hd = (HiddenField)e.Item.FindControl("HiddenField1");
            string str = hd.Value;
            SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
            cmd.CommandText = "Update requests set frnshpstatus='N' where Email='" + Session["UserName"] + "' And frnemail='" + str + "'";
            cmd.Connection = con;
            cmd.CommandType = CommandType.Text;
            cmd.ExecuteNonQuery();
        }
    }

}

On clicking on accept button the frnshpstatus in request table in Updated as ‘Y’ but it is still showing the accepted or deny requests in datalist.
I want them to remove only from datalist but keep the record of requests in database.
Answer in asp.net using c#.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T07:39:06+00:00Added an answer on June 10, 2026 at 7:39 am

    Am I right in thinking you want the row completely removed from the datalist after clicking either accept or reject? If that’s the case just add a where clause to your query that populates the datalist

    where frnshpstatus is null
    

    or whatever the default value is if not null. Then after you have completed the accept/reject process at the end of your ItemCommand event handler you’ll need to manually databind the datalist again

    DataList1.DataBind();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm having an weird problem, my project have a login page, that's working, but
Hello I have a page in an ASP.NET (website) project that writes a file
I have a Page that expects a POST Request and returns some JSON. Essentially
I am currently doing a project in which I have to request data from
I have a view in a Django 1.4 project: def index(request): print reverse('menus_index') latest_menu_list
I have a C++ project that have like 15+ external libraries installed with a
In a project I'm working on, I have an object that is a sort
I have a pretty straight forward uploadified page that allows users to upload files,
I've got a project that uses a Master Page. There is also a Content
I am trying to build a project-page setup that auto populates the project details

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.