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 6864473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:54:57+00:00 2026-05-27T02:54:57+00:00

Problem 1 I’m trying to use an Onclick event from a search button, that

  • 0

Problem 1

I’m trying to use an Onclick event from a search button, that is located on the master page, in a child page. I found a good solution on this site but it doesn’t work.

Link to it:
How to handle master page button event in content page?

The difference with that solution is that my IpageInterface is located in the App_Code folder and is in the namespace Business.

Other then that it’s pretty much the same.

So I have the IpageInterface class:

namespace Business {
    public interface IpageInterface {
        void DoSomeAction();
    }
}

Then on my master page I have:

using Business;

public partial class site : System.Web.UI.MasterPage {
    protected void SearchQuery_Click(object sender, EventArgs e) {
        IpageInterface pageInterface = Page as IpageInterface;
        if (pageInterface != null) {
            pageInterface.DoSomeAction();
        }
    }            
}

And finally I have, on the page I want to use it (results page, because the button is a search button):

using Business;

public partial class results : System.Web.UI.Page, IpageInterface {
public void DoSomeAction() {
    ContentPlaceHolder mainContent = (ContentPlaceHolder)Master.FindControl("mainContent");

    if (mainContent != null) {
        DropDownList ddlSearchOn = (DropDownList)mainContent.FindControl("ddlSearchOn");
        TextBox TxtSearch = (TextBox)mainContent.FindControl("TxtSearch");

        if (ddlSearchOn.Text == "Everything" || ddlSearchOn.Text == "Title" || ddlSearchOn.Text == "Text") {
            List<News> newsSearchResults = News.SearchNews(ddlSearchOn.Text, TxtSearch.Text);

            foreach(News newsArticle in newsSearchResults) {
                newsArticle.Text = LimitCharacters(newsArticle.Text, 350);
            }

            repeaterSearchResults.DataSource = newsSearchResults;
            repeaterSearchResults.DataBind();
        }
    }
}

But when I press the button, and I look at the value of pageInterface it says it’s null.

Problem 2

EDIT:
Problem 2 is solved. I selected ‘Cascade’ next to the delete rule in Foreign Key relationships window.

Besides that problem I have a second problem with MS SQL which goes as follows:
I have news articles with comments, when I want to remove the article I have to remove the comments as well, so I use the following query:

SqlCommand cmd = new SqlCommand(@"DELETE FROM News_comments WHERE News_comments.news_Id = @news_Id AND News_comments.account_Id = @account_Id;
                                              DELETE FROM News_news WHERE News_news.news_Id = @news_Id"
                                              , conn);

The problem is though, that it still seems to thing that the article still has comments, eventhough the comments are removed. So I can’t remove the article.
The exception is:

"The DELETE statement conflicted with the REFERENCE constraint" exception.

Would appreciate the needed help!

  • 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-05-27T02:54:58+00:00Added an answer on May 27, 2026 at 2:54 am

    It’s not really a solution to the problem I had with the code above but it is a solution to my situation.

    I just give the needed info to the child page through the url. It’s not personal or restricted data so it’s not a problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem: Ajax suggest-search on [ n ] ingredients in recipes. That is: match recipes
Problem: We have a web app that calls some web services asynchronously (from the
PROBLEM: I have a Child class which uses DataContractSerialization and raises a Changed event
Problem : Need onclick event to pause/unpause a Youtube video, but impossible to add
Problem: I have a large Visual C++ project that I'm trying to migrate to
Problem: Trying to create a Mix that is applied to the AVPlayerItem, but it
Problem: I have an address field from an Access database which has been converted
Problem: I have two spreadsheets that each serve different purposes but contain one particular
Problem (simplified to make things clearer): 1. there is one statically-linked static.lib that has
Problem: Given a list of strings, find the substring which, if subtracted from the

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.