|
-
September 22nd, 2010, 11:26 AM
#1
Combining textboxes to a buttons
Okey, so heres the deal, we just started on C#, as you might understand I'm a newbie!
I got a input field, four buttons and four outputfields. When I type something in the input field and click button 3 the text is gonna come in outputfield 3. same goes for every other button.
Tekst<asp:TextBox ID="txtbInput" runat="server"></asp:TextBox>
<br />
<asp:Button ID="btnKnapp1" runat="server" Text="Knapp1" OnClick="Button1" />
<asp:Button ID="btnKnapp2" runat="server" Text="Knapp2" OnClick="Button1" />
<asp:Button ID="btnKnapp3" runat="server" Text="Knapp3" OnClick="Button1" />
<asp:Button ID="btnKnapp4" runat="server" Text="Knapp4" OnClick="Button1" />
<br />
En<asp:TextBox ID="txtbUtskrift1" runat="server"></asp:TextBox><br />
To<asp:TextBox ID="txtbUtskrift2" runat="server"></asp:TextBox><br />
Tre<asp:TextBox ID="txtbUtskrift3" runat="server"></asp:TextBox><br />
Fire<asp:TextBox ID="txtbUtskrift4" runat="server"></asp:TextBox>
protected void Button1(object sender, EventArgs e)
{
Button button = (Button)sender;
txtbInput.Text = button.ID;
}
so what this do for me is input the ID of each button into the input field. So I've looked into Switch case, but I cant figure out how to do this! I dont want you guys to simply do the task for me, but give me heads up and point me in the right direction!
Thanks in advance!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|