Click here to Skip to main content
12,957,071 members (66,337 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I am trying to built an website.It contains two webforms:

1.Parent.aspx--->This page contains a scriptmanager,updatepanel(having one dropdownlist connected to a sqlsource,createnew button) and a Refresh button outside updatepanel.

-The dropdownlist displays the customer name from the sql table named Customer.

2.Child.aspx--->THis webform contains a textbox named txtCusName and a submit buttton.

Now,What i want to achieve is the following:

-> When the user is at parent.aspx.It looks for the customer name in the dropdownlist.When the user doesnt see the required customer name in list.He presses the createnew button.This will cause the child.aspx to appear over the parent.aspx.

->the user will create new customer name by using txtCusName and submit button.The new customer name gets save in the database.

I have implemented till here but after that when i close the child.aspx and press refresh button in the updatepanel on parent.aspx.The dropdownlist is not getting updated...

how can i update the dropdownlist????plz help me out????? i want to imlement it asap.
Posted 25-Dec-12 18:07pm
Zafar Sultan 26-Dec-12 3:31am
Have you checked the record is storing in the database? if yes, post the code for Parent.aspx here. We will check what's wrong with refresh...
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Please make sure that your refresh button and dropdownlist are in same update panel and you are binding dropdownlist with the customer data in refresh button click event.

If above every thing is right then put a break point into refresh button click event and check dropdownlist is binding with customer data or not.

Hope this will help you.
Member 9581909 26-Dec-12 11:21am
hi Mukhtar....
I am posting the complete code for parent.aspx.
The child.aspx is working absolutely fine.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Parent.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
<title>Main Form</title>

<script type="text/javascript">

function win_open() {"Child.aspx", "", "width=400,height=200", "fulscreen=no", "resizable=yes");


<style type="text/css">
#form1 {
height: 298px;
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">

<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="False"

<asp:Label ID="Label1" runat="server" Text="Customer"
style="z-index: 1; left: 38px; top: 54px; position: absolute">
<asp:DropDownList ID="DropDownList1" runat="server"

style="z-index: 1; left: 104px; top: 51px; position: absolute; height: 32px; width: 160px"
DataSourceID="SqlDataSource1" DataTextField="Customer_Name"

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:codeConnectionString %>"
SelectCommand="SELECT DISTINCT [Customer_Name] FROM [Customer]">

<asp:Button ID="BtnRef" runat="server" Text="Refresh"

style="z-index: 1; left: 338px; top: 49px; position: absolute; width: 137px"
onclick="BtnRef_Click" />
<asp:Button ID="Btnnew" runat="server" Text="Create New"

style="z-index: 1; left: 527px; top: 48px; position: absolute; width: 139px"
OnClientClick="win_open()" onclick="Btnnew_Click" />

<asp:AsyncPostBackTrigger ControlID="BtnRef" EventName="Click" />


And parent.aspx.cs code is as follows:

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

public partial class _Default : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)

protected void Btnnew_Click(object sender, EventArgs e)
String csname1 = "PopupScript";
Type cstype = this.GetType();
ClientScriptManager cs = Page.ClientScript;
if (!cs.IsStartupScriptRegistered(cstype, csname1))
StringBuilder cstext1 = new StringBuilder();
cstext1.Append(@" <script type=text/javascript> function open_win(){,"",width=400,height=200,fullscreen=no,resizable=yes);} );
cs.RegisterStartupScript(cstype, csname1, cstext1.ToString());
protected void BtnRef_Click(object sender, EventArgs e)
Member 9581909 26-Dec-12 11:22am
Kindly check the C# code for the REFRESH button.
Mohd. Mukhtar 27-Dec-12 5:23am
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">

Remove the "ChildrenAsTriggers="False" " from the above line and check.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I made a chaange in the c# code for the refresh button.
i just bound the dropdownlist with the button and it did the trick.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,924
CHill60 3,550
Maciej Los 3,312
ppolymorphe 2,120
Jochen Arndt 1,973

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 27 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100