I have a button that opens a window like such using a button click and a javascript function
This window basically allows you to search through a database for matching records and then posts the results in a gridview. I was wondering if there was a way so that if one selects a gridviewrow in the popup window, that it will change the selected row in the parent page. Ive looked all over the net and have found no clear answers on how to do this.
Ive already got some code setup to find the correct row on the parent page but dont know how to change the selected index or get a reference to it so I can.
This is my small routine in the search popup window that doesnt work because I cant access the gridview on the parent page.
I wanna select the parent gridviews row either on the close button of the popup or when a row is selected in the popup window...either or doesnt matter to me.
Thank you ahead of time.
Code:
function opensearchwindow()
{
window.open('Search.aspx', 'Pop_Up', 'width=600, height=500, menubar=no, toolbar=no, resizeable=no');
}
Code:
protected void btnSearch_Click(object sender, EventArgs e)
{
string openscript = "";
openscript += "opensearchwindow();";
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "openscript", openscript, true);
}
Ive already got some code setup to find the correct row on the parent page but dont know how to change the selected index or get a reference to it so I can.
This is my small routine in the search popup window that doesnt work because I cant access the gridview on the parent page.
Code:
protected void gvresults_SelectedIndexChanged(object sender, EventArgs e)
{
/*
GridViewRow row;
int index;
string id;
index = gvresults.SelectedIndex;
row = gvresults.Rows[index];
id = row.Cells[5].Text;
SqlCommand cmd = new SqlCommand("SELECT ID FROM General", csbg);
cmd.Parameters.AddWithValue("@id", id);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
GridView gv = (GridView)Page.PreviousPage.FindControl("gvSideList");
cmd.Connection.Open();
da.Fill(dt);
cmd.Connection.Close();
for (int i = 0; i < dt.Rows.Count; i++ )
{
if (dt.Rows[i].Equals(id))
{
RaisePostBackEvent(gv, "Select$" + i);
break;
}
}
*/
Thank you ahead of time.
Comment