Click here to Skip to main content
15,920,836 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
i have a repeater with full of data..now on a button click one of the data will be shown in the lightbox and then i can update this by ajax json...

can any one tell me how to get the data from repeater to lightbox...

thanks
Posted
Comments
What have you tried and where is the problem?
Nelek 27-Dec-13 4:04am    
Don't think we can read minds or do astral projections to see your monitor. If you need help, the least you could do is to add some relevant code to your question or to explain your problem in such a way, that the users of CP can understand it. Otherwise, nobody will be able to help you.

Please use the "improve question" and add relevant information or a piece of code envolved. There are thousands of ways to screw things up, how are we supposed to know which one did you choose?

What Tadit wants you to ask in the above comment is very well explained in this link:What have you tried?[^]

1 solution

asp code

XML
<div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
        <asp:Repeater ID="Repeater1" runat="server" OnItemCommand="Repeater1_ItemCommand"
            OnItemDataBound="">
            <ItemTemplate>
                <asp:Label ID="Label2" runat="server" Text='<%# Eval("ContactName") %>'></asp:Label>&nbsp;
                <asp:Label ID="Label1" runat="server" Text='<%# Eval("ContactID") %>'></asp:Label>

                <asp:Button ID="Button1" runat="server" Text="view" CommandArgument='<%# Eval("ContactID") %>' CommandName="view" />
                <asp:Button ID="Button2" runat="server" Text="view" CommandArgument='<%# Eval("ContactID") %>' CommandName="edit" />
            </ItemTemplate>
        </asp:Repeater>
            <br /><br />

            <div id="div1" runat="server" Visible="false" style="background-color: #FF66FF">
            <div>
            name =
                <asp:Label ID="Label1" runat="server" Text="" Visible="false"></asp:Label>
                <br />
                <asp:TextBox ID="TextBox1" runat="server" Visible="false"></asp:TextBox>
                <input id="btn1" type="button" value="submit" onclick="return btn1_onclick()" />
            </div>
            </div>
        </ContentTemplate>
        </asp:UpdatePanel>
    </div>



cs code :

protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable table = new DataTable();
                table.Columns.Add("ContactID", typeof(int));
                table.Columns.Add("ContactName", typeof(string));


                //
                // Here we add five DataRows.
                //
                table.Rows.Add(25, "Indocin");
                table.Rows.Add(50, "Enebrel");
                table.Rows.Add(10, "Hydralazine");
                table.Rows.Add(21, "Combivent");
                table.Rows.Add(100, "Dilantin");

                Repeater1.DataSource = table;
                Repeater1.DataBind();
            }
            
        }

        

        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "view")
            {
                string la = ((Label)Repeater1.Items[e.Item.ItemIndex].FindControl("Label2")).Text;
                //Response.Write("<script>alert('" + la + "');</script>");
                Label1.Text = la;
                //Label1.Attributes.Add("display","block");
                div1.Visible = true;
                Label1.Visible = true;
            }
            else if(e.CommandName=="edit")
            {
                TextBox1.Text = ((Label)Repeater1.Items[e.Item.ItemIndex].FindControl("Label2")).Text;
                //Label1.Attributes.Add("display","block");
                div1.Visible = true;
                TextBox1.Visible = true;
            }
        }




now change the div1 according to the lightbox design with css....
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900