This is a migrated thread and some comments may be shown as answers.

open radwindow with gridview selectedindexchanged

4 Answers 164 Views
Window
This is a migrated thread and some comments may be shown as answers.
Somy
Top achievements
Rank 1
Somy asked on 02 May 2013, 08:52 AM
I have a gridview with a command field. at selected index change I set the gridviews row content to some textboxes.
I want to open a radwindow with selected indexchanged of gridview but I couldn't do that.
my code for radwindow at aspx file is:
<telerik:RadWindow ID="RadWindow1" runat="server" Width="800px" Height="600px" Modal="true"  OpenerElementID="showDialog" OnClientClose="clientClose" OnClientShow="clientShow" ReloadOnShow="true">
       
      <ContentTemplate>
      <asp:TextBox ID="TxtTitle" runat="server"></asp:TextBox>
      <br />
      <asp:TextBox ID="TxtDetail" runat="server"></asp:TextBox>
      <br />
      <asp:TextBox ID="TxtDate" runat="server"></asp:TextBox>
      <br />
       
 
      <telerik:RadEditor ID="RadEditor1" runat="server"  ImageManager-ViewPaths="~/Images"
  ImageManager-UploadPaths="~/Images"
  ImageManager-DeletePaths="~/Images">
      </telerik:RadEditor>
 
      <br />
 
 
      <asp:FileUpload ID="FileUpload1" runat="server" />
      <br />
      <asp:CheckBox ID="ChkActive" runat="server" />
      <br />
      <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="save" />
      <br />
 
      </ContentTemplate>
      </telerik:RadWindow>
and the code behind for selectedindexchanged:
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
   {
        
       int index = GridView1.SelectedIndex;
       TextBox txttitle = (TextBox)(GridView1.Rows[index].FindControl("TxtTitle"));
       TxtTitle.Text = txttitle.Text;
 
       TextBox tx = (TextBox)(GridView1.Rows[index].FindControl("TxtDetail"));
       TxtDetail.Text = tx.Text;
       TextBox descttext = (TextBox)(GridView1.Rows[index].FindControl("TxtDesc"));
       RadEditor1.Content = descttext.Text;
       CheckBox chk = ((CheckBox)GridView1.Rows[index].FindControl("Chactive"));
       ChkActive.Checked = chk.Checked;
 
   }

4 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 02 May 2013, 09:58 AM
Hi,

Try the following code.
c#:
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
    string script = "function f(){$find(\"" + RAdwindow1.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
}

Thanks,
Shinu
0
Somy
Top achievements
Rank 1
answered on 02 May 2013, 12:02 PM
Thank you for helping, 
I used the code but nothing happen when clicking for edit and the window dose not load.
0
Shinu
Top achievements
Rank 2
answered on 03 May 2013, 04:27 AM
Hi,

If you want to load the window in edit mode, try the following code.
c#:
  protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
        if (e.CommandName == RadGrid.EditCommandName)
        {
            string script = "function f(){$find(\"" + Radwindow1.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
        }
}

Thanks,
Shinu
0
Somy
Top achievements
Rank 1
answered on 03 May 2013, 05:22 AM
No, I don't want to use the code at edit command.
I want to use it at gridview selected index change. I don't know why the window didn't load.
 I deleted some properties that I used for the radwindow, and now it works.
thank you for helping.
Tags
Window
Asked by
Somy
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Somy
Top achievements
Rank 1
Share this question
or