Click here to Skip to main content
15,890,947 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHelp in understanding PopupControlExtender Pin
simsen19-Feb-11 0:10
simsen19-Feb-11 0:10 
QuestionRe: Help in understanding PopupControlExtender Pin
Sunasara Imdadhusen21-Feb-11 23:22
professionalSunasara Imdadhusen21-Feb-11 23:22 
QuestionFormat Dynamic GridView at runtime Pin
Andy_L_J18-Feb-11 23:22
Andy_L_J18-Feb-11 23:22 
Questionc#+object copy Pin
Ramkumar_S18-Feb-11 16:30
Ramkumar_S18-Feb-11 16:30 
AnswerCross Post Pin
dan!sh 19-Feb-11 0:05
professional dan!sh 19-Feb-11 0:05 
QuestionRunning a web application on two windows Pin
xyz_999@hotmail.com18-Feb-11 5:19
xyz_999@hotmail.com18-Feb-11 5:19 
AnswerRe: Running a web application on two windows Pin
Steve Maier18-Feb-11 5:50
professionalSteve Maier18-Feb-11 5:50 
QuestionAssign a Textbox in the parent page from a ModalPopup in asp.net Pin
Vimalsoft(Pty) Ltd17-Feb-11 23:40
professionalVimalsoft(Pty) Ltd17-Feb-11 23:40 
I see a lot of people have been asking this question, some was because of the if postback check , but mine is different. i am using AjaxModalExtender to show my popup on the server side. this is my markup

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestPage.aspx.cs" Inherits="PopTester.TestPage" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<style type="text/css">

 .modalBackground
{     background-color: Yellow;
      filter: alpha(opacity=60);
      opacity: 0.6;
}

   </style>

 
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"> 
    </asp:ScriptManager>

    <asp:Panel ID="Panel1" runat="server">

    <asp:Button ID="Button1" runat="server"

    Text="CreateModal" OnClick="Button1_Click" />

    </asp:Panel>


         <asp:Panel ID="ModalPanel" runat="server" Style="display: none" HorizontalAlign="Center" BackColor="Green">
             <div>
     <asp:UpdatePanel ID="Update" runat="server">
     <ContentTemplate>
        <asp:GridView ID="GridView1"  AutoGenerateColumns="false" runat="server" Height="176px" Width="453px">
        <Columns>
        <asp:TemplateField HeaderText="ID">
        <ItemTemplate>
        <asp:CheckBox ID="chkId" runat="server" />
        <asp:Label ID="lblId" runat="server" Text='<%#Eval("ID")%>'></asp:Label>
        </ItemTemplate>
        </asp:TemplateField>
        
        <asp:TemplateField HeaderText="Name">
        <ItemTemplate>
        <asp:Label ID="lblname" runat="server" Text='<%#Eval("Name") %>'></asp:Label>
        </ItemTemplate>
        </asp:TemplateField>

        
        <asp:TemplateField HeaderText="Lastname">
        <ItemTemplate>
        <asp:Label ID="lblLastname" runat="server" Text='<%#Eval("Lastname") %>'></asp:Label>
        </ItemTemplate>
        </asp:TemplateField>
        </Columns>

        </asp:GridView>

             <asp:Button ID="btnPickrecord" runat="server" Text="Pick Record" 
             onclick="btnPickrecord_Click "   />
    <asp:Button ID="btnload" runat="server" onclick="btnload_Click"  
        Text="Load Data" />
                </ContentTemplate>
     </asp:UpdatePanel>
     
        </div>
        <asp:Button ID="btnCancel" runat="server" Text="Close Me" 
                 onclick="btnCancel_Click" />
    </asp:Panel>
        <asp:TextBox ID="txtreference" runat="server" AutoPostBack="True"></asp:TextBox>
        <p>
            &nbsp;</p>
    </form>
</body>
</html>


as you can see i have a gridview that will be on the modal and its working fine, now after the grid has returned some results, i will select one record via the checkbox on the Grid and click the button "btnPickrecord" and this will fire my server side code


protected void btnPickrecord_Click(object sender, EventArgs e)
{
         foreach (GridViewRow dataItem in GridView1.Rows)
        {

            CheckBox chkselect = (CheckBox)dataItem.FindControl("chkId");

            if (dataItem.RowType == DataControlRowType.DataRow)
            {
                  if (chkselect.Checked)
                  {
                      Label lblReferenceNumberID = (Label)dataItem.FindControl("lblId");

                      txtreference.Text = lblReferenceNumberID.Text;
                  }
            }
         }
}


the breakpoints got a hit and i stepped through it and i the value get assigned to the textbox txtreference.Text , but when i close the modal the textbox is empty , or while the modal is open i can see the value does not reflect in the parent page. Here is the Code for invoking the modal


protected void Button1_Click(object sender, EventArgs e)
        { 
            AjaxControlToolkit.ModalPopupExtender modalPop = new AjaxControlToolkit.ModalPopupExtender();

            modalPop.ID = "popUp";

            modalPop.PopupControlID = "ModalPanel";

            modalPop.TargetControlID = "Button1";

            modalPop.DropShadow = true;

            modalPop.BackgroundCssClass = "modalBackground";

            modalPop.CancelControlID = "btnCancel";

            this.Panel1.Controls.Add(modalPop); 

            modalPop.Show();
        }



Thanks
Vuyiswa Maseko,

Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.

C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/

AnswerRe: Assign a Textbox in the parent page from a ModalPopup in asp.net Pin
Anurag Gandhi18-Feb-11 0:35
professionalAnurag Gandhi18-Feb-11 0:35 
GeneralRe: Assign a Textbox in the parent page from a ModalPopup in asp.net Pin
Vimalsoft(Pty) Ltd18-Feb-11 0:55
professionalVimalsoft(Pty) Ltd18-Feb-11 0:55 
GeneralRe: Assign a Textbox in the parent page from a ModalPopup in asp.net Pin
Anurag Gandhi18-Feb-11 1:18
professionalAnurag Gandhi18-Feb-11 1:18 
GeneralRe: Assign a Textbox in the parent page from a ModalPopup in asp.net Pin
Vimalsoft(Pty) Ltd18-Feb-11 1:29
professionalVimalsoft(Pty) Ltd18-Feb-11 1:29 
Questioncross query Pin
C#Coudou17-Feb-11 13:45
C#Coudou17-Feb-11 13:45 
AnswerRe: cross query Pin
GlobX17-Feb-11 14:45
GlobX17-Feb-11 14:45 
GeneralRe: cross query Pin
C#Coudou17-Feb-11 14:58
C#Coudou17-Feb-11 14:58 
GeneralRe: cross query Pin
GlobX17-Feb-11 15:08
GlobX17-Feb-11 15:08 
GeneralRe: cross query Pin
C#Coudou17-Feb-11 15:15
C#Coudou17-Feb-11 15:15 
GeneralRe: cross query Pin
thatraja17-Feb-11 15:28
professionalthatraja17-Feb-11 15:28 
AnswerRe: cross query Pin
Lisa Z. Morgan23-Feb-11 6:10
Lisa Z. Morgan23-Feb-11 6:10 
AnswerRe: cross query Pin
Anurag Gandhi17-Feb-11 22:13
professionalAnurag Gandhi17-Feb-11 22:13 
QuestionStrange Behavior in DevExpression Ajax Pin
Vimalsoft(Pty) Ltd17-Feb-11 8:15
professionalVimalsoft(Pty) Ltd17-Feb-11 8:15 
QuestionList of Object Pin
fififlowertot17-Feb-11 0:40
fififlowertot17-Feb-11 0:40 
AnswerRe: List of Object Pin
Ravi Sant17-Feb-11 0:57
Ravi Sant17-Feb-11 0:57 
GeneralRe: List of Object Pin
Dalek Dave4-Mar-11 13:42
professionalDalek Dave4-Mar-11 13:42 
QuestionAdding a C# UserControl DLL in ASP Web Page Pin
Pawan_bhat16-Feb-11 21:58
Pawan_bhat16-Feb-11 21:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.