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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:14:27+00:00 2026-05-16T21:14:27+00:00

What I would like to do is have the user add a new record

  • 0

What I would like to do is have the user add a new record to the database and popup a JQuery dialog confirming that the new record was saved. I thought this would be a simple exercise. I have a gridview bound to a LINQDataSource to allow the user to view and edit existing records and a textbox and a button to add new codes.

In the head of the document, I have the following:

$('#dialog').dialog({
    autoOpen: false,
    width: 400,
    buttons: {
        "Ok": function () {
            $(this).dialog("close");
        }
    }
});

and futher down in the markup I have:

<div id="dialog" title="New Code Added">
<p>"<asp:Literal runat="server" ID="LiteralNewCode"></asp:Literal>" was successfully added.</p>
</div>

So when the user enters a new description and it passes all the validation, it’s added to the database and the gridview is rebound to display the new record.

protected void ButtonSave_Click(object sender, EventArgs e)
{
    if (Page.IsValid)
    {
        CCRCode.Add( <long list of paramters> );
        GridCode.DataBind();

        IsNewCode = true;
        NewDescription = <new description saved to database>;
    }
}

Now, here’s where (I thought) I’d set a boolean property to indicate that a new description had been added as well as the text of the new description. See below:

protected bool IsNewCode
{
    get { return ViewState["IsNewCode"] != null ? (bool)ViewState["IsNewCode"] : false; }
    set { ViewState["IsNewCode"] = value; }
}

private string NewDescription
{
    get { return ViewState["NewDescription"] != null ? ViewState["NewDescription"].ToString() : string.Empty; }
    set { ViewState["NewDescription"] = value; }
}

Here’s where I loose my way. My guess is I want to add functionality to include code similar to:

$('#dialog').dialog('open');

I’ve added a registerscriptblock method in the page_load event but that didn’t work. Any ideas? Or am I just going about this entirely wrong?

Thanks.

  • 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-16T21:14:27+00:00Added an answer on May 16, 2026 at 9:14 pm

    Not really get what you want to do. But, i use jquery alot with .NET in my projects. here is how i do, probably could give you a hint.

    foo.aspx.cs

    public String ScriptToRun = "$('#dialog').dialog('open');";
    

    change the value of ScriptToRun in your C# code

    foo.aspx

    $(document).ready(function() {<%=ScriptToRun %>});
    

    Remember that whatever you done in backend is going to generate HTML, Css& javascript to browser.

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

Sidebar

Related Questions

I have a MySQL user added to a database that I would like to
I would like to have a text field that a user can enter a
I would like to have a checkbox preference that takes the user to a
We have a customer that would like to modify application user messages that we
Still an iphone dev starter but trying. I would like to have the user
I would like to have the page on user/sidebar on the right in the
I would like to make my user control have invisible areas like the areas
I have two tables user and log. I would like to join the user
I would like to make my own user-mode NAT application. I have the folowing
We have a bunch of user controls we would like to pull out of

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.