hi everyone ,i want to sent value of textbox in listview use button to another page,i use this code but program take an error that:
Object reference not set to an instance of an object.
protected void addtobasket_Click(object sender, System.EventArgs e)
{
string count2 = (((sender as Button).Parent as ListViewItem).FindControl("txtcount") as TextBox).Text;
}
<ItemTemplate>
<asp:TextBox ID="txtcount" type="text" runat="server" Width="30"></asp:TextBox>
<asp:Button ID="addtobasket" runat="server" Text="Add to basket" OnClick="addtobasket_Click">
</asp:Button>
</ItemTemplate>