sam jame

sam jame

  • NA
  • 60
  • 0

ModalPopupExtender popup an gridview click on select command value set on parent gridview

Jan 21 2010 6:25 AM
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!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">
    <title>Untitled Page</title>
        <link href="StyleSheet.css" rel="stylesheet" type="text/css" />   
    <script type="text/javascript">
    var styleToSelect;
    function onOk() {
    document.getElementById('Paragraph1').className = styleToSelect;
    }
</script>

    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
   
    <asp:LinkButton ID="LinkButton1" runat="server">Please click to select an alternate text style.</asp:LinkButton><br />
        <br />
        <asp:Button ID="Button1" runat="server" Text="Button" /><br />
        <br />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="CategoryID"
            DataSourceID="SqlDataSource1">
            <Columns>
                <asp:BoundField DataField="CategoryID" HeaderText="CategoryID" InsertVisible="False"
                    ReadOnly="True" SortExpression="CategoryID" />
                <asp:BoundField DataField="CategoryName" HeaderText="CategoryName" SortExpression="CategoryName" />
                <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:Button ID="Button2" runat="server" Text="Button" />                      
                  
                       
                        <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
             TargetControlID="Button2"
             PopupControlID="Panel2"  />
                        &nbsp;<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />
            
                    </ItemTemplate>
               
               
                </asp:TemplateField>
               
            </Columns>
        </asp:GridView>
       
       
        <asp:Panel ID="Panel2" runat="server" Height="50px" Width="125px">
                            &nbsp;<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataKeyNames="CategoryID"
                                DataSourceID="SqlDataSource1" OnSelectedIndexChanged="GridView2_SelectedIndexChanged" OnRowCommand="GridView2_RowCommand">
                                <Columns>
                                    <asp:CommandField ShowSelectButton="True" />
                                    <asp:BoundField DataField="CategoryID" HeaderText="CategoryID" InsertVisible="False"
                                        ReadOnly="True" SortExpression="CategoryID" />
                                    <asp:BoundField DataField="CategoryName" HeaderText="CategoryName" SortExpression="CategoryName" />
                                    <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
                                </Columns>
                            </asp:GridView>
                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></asp:Panel>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            SelectCommand="SELECT [CategoryID], [CategoryName], [Description] FROM [Categories]">
        </asp:SqlDataSource>
        <br />
        <br />
        &nbsp;
      
      <%--   <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
             TargetControlID="Button1"
             PopupControlID="Panel2"  />--%>
       
       
   
    </div>
       
    </form>
</body>
</html>