7
Answers

ModalPopupExtender problem.

Vikas Ahlawat

Vikas Ahlawat

14y
10.7k
1
I have taken ModalPopupExtender and in the panel iframe , i have set the src or iframe at run time.
when ModalPopupExtender open then i want to click on the save button of src page which have in the model popup currently and at this event i want to close this modal popup and want to refresh. How can i do this?

<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
     okcontrolid="btnOkay"
    targetcontrolid="btnAdd"
    popupdraghandlecontrolid="PopupHeader" drag="true"
    >
    </cc1:ModalPopupExtender>
    
    
    <asp:Button ID="btnAdd" runat="server" onclick="Button1_Click" Text="ADD" />
 
&nbsp;<asp:Button ID="btnUpdate" runat="server" onclick="btnUpdate_Click"
        Text="UPDATE" />
&nbsp;
    <asp:Button ID="btnDelete" runat="server" onclick="btnDelete_Click"
        Text="DELETE" />
    <br />
    
    
    
    <asp:panel id="Panel_StudentProspects" style="display: none" runat="server" >
            <div class="popup_Container" style="size:auto">
            
                <div class="popup_Titlebar" id="Div1">
                    <div class="TitlebarLeft">Student Prospects</div>
                    <div id="spcancelcross"class="TitlebarRight"  ></div>
                </div>

                <iframe id="frameeditexpanse" frameborder="0" runat="server"
                    scrolling="auto" style="width:550px; height:500px;"></iframe>
                  
                   
                   
            </div>
             <input id="btnOkay" type="button" value="Done" />
                    <input id="btnCancel" type="button" value="Cancel" />
    </asp:panel>
Answers (7)
0
Satyapriya Nayak
NA 53k 8m 12y
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;

namespace Retrieving_excel_data_to_combobox
{
    public partial class Form1 : Form
    {
        public OleDbConnection con;
        public void pintu(string s)
        {
            con = new OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; " + "data source='" + s + " '; " + "Extended Properties=Excel 8.0;");

        }
        public OleDbCommand com;
        public DataSet ds;
        public OleDbDataAdapter oledbda;
        public DataTable dt;
        public string str;

        public Form1()
        {
            InitializeComponent();
        }

        private void btnbrowse_Click(object sender, EventArgs e)
        {
            OpenFileDialog openfiledialog1 = new OpenFileDialog();
            openfiledialog1.ShowDialog();
            openfiledialog1.Filter = "allfiles|*.xls";
            TextBox1.Text = openfiledialog1.FileName;

        }

       

        private void btndisplay_Click(object sender, EventArgs e)
        {
            pintu(TextBox1.Text);
            try
            {
                con.Open();
                str = "select * from [sheet1$]";
                com = new OleDbCommand(str, con);
                ds = new DataSet();
                oledbda = new OleDbDataAdapter(com);
                oledbda.Fill(ds, "[sheet1$]");
                con.Close();
                DataGridView1.DataSource = ds;
                DataGridView1.DataMember = "[sheet1$]";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
    }
}

0
Tharake Gunatilake
NA 53 52.1k 12y
I got the answer guys..

 private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofImport = new OpenFileDialog();
            ofImport.Title = "Select file";
            ofImport.InitialDirectory = @"c:\";
            ofImport.FileName = openFileDialog1.FileName;
            ofImport.Filter = "Excel Sheet(*.xlsx)|*.xlsx|All Files(*.*)|*.*";
            ofImport.FilterIndex = 1;
            ofImport.RestoreDirectory = true;


            if (ofImport.ShowDialog() == DialogResult.OK)
            {

                string path = System.IO.Path.GetFullPath(ofImport.FileName);

                string query = "SELECT * FROM [Sheet1$]";

                OleDbConnection conn = new OleDbConnection();

                conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + ofImport.FileName + ";Extended Properties=" + "\"Excel 12.0 Xml;HDR=YES;IMEX=1\"";

                OleDbDataAdapter adapter = new OleDbDataAdapter(query, conn);

                DataSet dataSet = new DataSet();

                adapter.Fill(dataSet);

                dataGridView1.DataSource = dataSet.Tables[0];


            }
            else
            {
                ofImport.Dispose();
            }   
        }