Click here to Skip to main content
15,909,624 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
HiHow to find which button was clicked in a repeater itemtemplate and find the data of textbox.
Basically this task related to jobs.
Repeater I have to bind data like this

C#
<%# Eval("Title") %><%# Eval("Desription") %>

C#
jobsdisplay.DataSource = page;
jobsdisplay.DataBind();

In page load I have bind using linq query.In repater I have a linkbutton name send. When I click the link button to open popup.In popup 2 textboxes and one send button. These 3 controls also in repeater. when I entered two emails on two text boxes and then click send button to send the job to email, which I entered in two textboxes.My problem is I found the linkbutton using command argument.
C#
CommandName="Email" CommandArgument='<%# Eval("Id")%>'

C#
if (e.CommandName == "Email")
{
  TextBox txtto = (TextBox)e.Item.FindControl("txtto");
  Response.write(txtto.text);
}

My problem is i entered txtbox values manually I am not getting textbox data which I entered in txtbox.

Please help me.
Thank you.
Posted
Updated 1-Jun-14 19:44pm
v2
Comments
DamithSL 2-Jun-14 1:01am    
are you bind data in page load method? can you post the code?
NagaRaju Pesarlanka 2-Jun-14 1:48am    
var getcompaniesbyip = dc.getcompaniesbyip(cntid);
if (getlocationbyip != null)
{
rptcompanies.DataSource = getcompaniesbyip;
rptcompanies.DataBind();
}
using stored proc, cntid is the coutry id, based on country we will display the job

1 solution

C#
foreach (RepeaterItem item in ReapeaterName.Items)
    {
        TextBox txt= (TextBox)item.FindControl("TextBox1");
        string b = txt.Text;
        Label2.Text += b + " . ";
    }
 
Share this answer
 
Comments
NagaRaju Pesarlanka 2-Jun-14 8:25am    
I am getting empty values like txt.text=""

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