Hi All,
thanks for your help in advance
i have a textbox and a linkbutton and need to link them together
in other words need the linkbutton to know what i have put in the textbox s i click on it,
first off it is in a repeater control
each row has a linkbutton which text value gets dynamically assigned each time the page is loaded, the information in the textbox is entered by the user so is different each time
My page load code is as follows:
Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim myConnection As SqlConnection
Dim myCommand As SqlDataAdapter
myConnection = New SqlConnection("server=spumbu\sqlexpress;" & "database=oss;Trusted_Connection=Yes")
myCommand = New SqlDataAdapter("SELECT NAME, SKU, DESCRIPTION, SALEPRICE, LOCATION, SALEPRICEPER100G FROM Products1 where CATEGORY Like 'Lollies' Order by 'Name'", _
myConnection)
Dim ds As DataSet = New DataSet()
myCommand.Fill(ds)
MyRepeater.DataSource = ds
MyRepeater.DataBind()
End If
End Sub
so by using the CType command i can get the website to understand what button is clicked and place it in a label or literal however i can not get the linkbutton to capture the text with a textbox on the same row, can anyone give me a so called 'Kick' in the right direction
to get the label to display the text value of the linkbutton is as follows
Code:
Protected Sub MyRepeater_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles MyRepeater.ItemCommand
Label1.Text = "The " & CType(e.CommandSource, LinkButton).Text & "button has been clicked"
End Sub
oh yes you will need the linkbutton code too
Code:
<asp:Linkbutton ID="btnFeature" runat="server" CommandName="Select" Text='<%#DataBinder.Eval(Container.DataItem, "SKU") %>'>
</asp:linkbutton>
anyhelp is always appreciated
thanks again in advance
Rob