Click here to Skip to main content
15,893,663 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i m having one text box,list box and two button.

when i click button1 the webaddress which we entered is moved to listbox.
like that by adding more than one webaddress to list box.
now when i click second button the address in list box open in multiple new window.
my code is
<table>
  <tr>
  <td>
  <asp:TextBox ID="txtMail" runat="server"></asp:TextBox>
  </td>
  <td>
  <asp:ListBox ID="List" runat="server"></asp:ListBox>
  <a href="Default.aspx" runat="server"></a>
  </td>
  </tr>
  <tr>
  <td colspan="2" align="center">
      <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
  <asp:Button ID="btnClick" Text="Click" runat="server" onclick="btnClick_Click" />
  </td>
  </tr>
  </table>




in code behind
protected void Button1_Click(object sender, EventArgs e)
    {
        List.Items.Add(txtMail.Text);

    }


protected void btnClick_Click(object sender, EventArgs e)
    {
what can i do here
    }


by using javascript means tell me the code
Posted
Updated 22-Apr-11 5:54am
v8
Comments
Manfred Rudolf Bihy 21-Apr-11 17:29pm    
I said edit in my comment below and not to repost. Please use the link "Improve question" underneath your question.
Thank you!

Use the target attribute of the anchor tag to achieve that:

XML
<a target="_blank" href="http://www.google.com">Go and google it!</a>


That's all there is to it!

Regards,

-MRB
 
Share this answer
 
Comments
beginner in C#.net 21-Apr-11 17:01pm    
i want to open the listbox data
Manfred Rudolf Bihy 21-Apr-11 17:14pm    
Unclear what you're up to:

So go and edit your question and add all the nescessary details of what you are trying to do then. We're no mind readers here at CP (well except maybe OriginalGriff , SA and some of the other members ;)).
Nish Nishant 21-Apr-11 17:42pm    
He wants to popup a window with the listbox contents. That's what I interpreted his question to mean.
Manfred Rudolf Bihy 21-Apr-11 17:50pm    
If that is what OP wants, then OP should tell us. It sounds to me as though you might be unto the right track :). If that really is what OP is up to we still would be in need of more information on when this pop up should be triggered and by what.

Let's see what OP has to say about this.
beginner in C#.net 21-Apr-11 18:36pm    
sorry people i couldn't get that... i am new to .net...
I am not sure about your question, but here is my solution

//Javascript
<script>
    function openItem(ctrl)
    {
        window.open(ctrl.value);
    }
</script>
//ASPX
 <asp:listbox id="ListBox1" runat="server" onclick="openWebSite(this)" xmlns:asp="#unknown">
            <asp:listitem text="http://www.google.com"></asp:listitem>
            <asp:listitem text="http://www.yahoo.com"></asp:listitem>
        </asp:listbox>
 
Share this answer
 

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