sagar Bhosale

sagar Bhosale

  • NA
  • 179
  • 175.8k

How to display data in griddviwe after login in child page display grid viwe data in Parent page

Jul 19 2011 10:08 PM
Hi friends,
 I have one parent page where i have one grideviwe bind with value 
i want to display that gridviwe only when user login into child page
 once user login into child page after closing login childpage 
& data should be display in gridviwe of Paren page How to doths 
plz help  me

Thanks

my .aspx code
<body>
  <form id="form1" runat="server">
  <script type="text/javascript">
  function loginwindow()
  {
//  window.prompt("Enter password","");
  }
 
  function openPopup() {
  var newwin = window.open("Popup.aspx", "Login", "dialogHeight: 330px; dialogWidth: 450px;scroll:no");
  newwin.focus();
  //window.location.reload();
  }
 
 
  </script>
  <table width="100%" cellpadding="0" border="1" cellspacing="0">
  <tr>
  <td align="right">
  &nbsp;</td>
  <td rowspan="3">
  <asp:TextBox runat="server" ID="txtqueryexec" CssClass="TextBox" Height="22px" Width="90%"></asp:TextBox>
 
  </td>
  </tr>
  <tr><td align="center"><asp:DropDownList CssClass="DropDown" runat="server" ID="drpdwn_query" OnSelectedIndexChanged="drpdwn_query_SelectedIndexChanged" AutoPostBack="True">
  <asp:ListItem  Value="0">Select Query</asp:ListItem>
  <asp:ListItem Value="1">SELECT</asp:ListItem>
  <asp:ListItem Value="2">INSERT</asp:ListItem>
  <asp:ListItem Value="3">UPDATE</asp:ListItem>
  </asp:DropDownList></td></tr>
  <tr><td style="height: 21px">&nbsp;</td></tr>
  <tr><td>&nbsp;</td></tr>
  <tr>
  <td>&nbsp;</td><td>
<asp:Button runat="server" ID="btnexec" Text="EXECUTE" CssClass="SaveButton" OnClick="btnexec_Click" OnClientClick="javascript:openPopup();return false;"/></td>  //i have doubt here becouse i call return false statment after js functin how i bind data with gridviwe
  </tr>
 
  <tr>
  <td colspan="2">
  <asp:GridView runat="server" ID="gv_command" AutoGenerateColumns="true" Visible="false" Width="100%"></asp:GridView>
  </td>
  </tr>
  <tr>
  <td>
  <asp:Label runat="server" ID="lbl_records" Visible="false" Text=""></asp:Label>
  </td>
  </tr>
 
  </table>
  </form>
</body>

aspx.cs code

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class queryeditor : System.Web.UI.Page
{
  clientinfo objclient = new clientinfo();
  public string pageredirect;
  protected void Page_Load(object sender, EventArgs e)
  {
  if (!IsPostBack)
  {
  string ID = Request.QueryString["0"];
  txtqueryexec.Text = "";

  }
 
 
  }
  protected void btnexec_Click(object sender, EventArgs e)
  {
  FillGrid();
 
 
 

  }
  private void FillGrid()
  {
 
  DataSet ds = objclient.get_queryexec(drpdwn_query.SelectedItem.Text, txtqueryexec.Text);
  if (ds.Tables[0].Rows.Count > 0)
  {
  gv_command.Visible = true;
  gv_command.DataSource = ds;
  gv_command.DataBind();
  }
 
  }
  protected void drpdwn_query_SelectedIndexChanged(object sender, EventArgs e)
  {
 
  string query = drpdwn_query.SelectedItem.Text;
  switch(query)
  {
  case "SELECT":
  txtqueryexec.Text = "SELECT * FROM  [TABLENAME]";
  break;

  case "INSERT":
  txtqueryexec.Text = "INSERT INTO  [TABLENAME]  [(col1, col2, col3,...colN)]  VALUES  (value1, value2, value3,...valueN)";
  break;

  case "UPDATE":
  txtqueryexec.Text = "UPDATE  [TABLENAME]  SET column_1 = [value1], column_2 = [value2]";
  break;
  }
  }
}







Answers (2)