How can i create a link i a table???

  • Thread starter Thread starter Apollo0130
  • Start date Start date
A

Apollo0130

hi, how can i create a link in a table in a webform, which links to
another page???
please help me, my project must go on... :?

Apollo0130 :)
 
this is a bit vague.
Is it just an html table, a datagrid, datatable or repeater.
Is it a static link, a link from a database.

try using the linkbutton control

Apollo0130 said:
hi, how can i create a link in a table in a webform, which links to
another page???
please help me, my project must go on... :?

Apollo0130 :)
 
Your are very vague on what you really want so i submit the Following.
you can try using it as a basis to build on

Table TmpTable = new Table();
TableRow TmpRow = new TableRow();
TableCell TmpCell = new TableCell();
LinkButton lnkButton = new LinkButton();
TmpTable.Rows.Add(TmpRow);
TmpRow.Cells.Add((TmpCell));
TmpCell.Controls.Add(lnkButton);
TmpCell.Width = new Unit("200px");
TmpRow.Height = new Unit("25px");
lnkButton.Click += new EventHandler(lnkButton_Click);
lnkButton.Style.Add("width", "100%");
lnkButton.Style.Add("height", "100%");
lnkButton.Text = "Go Here";
 
hi again, i am using the table component and the tip with the link
button is very good. i have added the code (with some changes) into
my code, but how can i create an "click"-event??? on the website
where my table is, is a link, but i can´t click the link and no site
will open.
how can i create such an click-event which can open a new site or call
a function?

Apollo0130
 
lnkButton.Click += new EventHandler(lnkButton_Click);
if you type that (do not copy and paste it when you get to the
eventhandler part and hit tab vs.net "should" auto create the event for
you. If it does not then use the following code
void lnkButton_Click(object sender, EventArgs e)
{
// put your code here such as
Response.Redirect("gotomypage.aspx");
}
 
hi, it doesn´t work! when i´m typing "lnkButton.Click" the program
writes "public event click is an event and can not be called
directly...?!?!?! i´m using vb.net...is there really another syntax
as i C#? i´ve tested it with declarations and other constructions,
but it will not run :cry:

is there another possibility to create a link in the table???
...don´t leave me alone :wink: ...

Apollo0130
 
' attaches event handler
AddHandler lnkButton.Click, AddressOf lnkButton_Clicked


Public Sub lnkButton_Clicked(ByVal sender As System.Object, ByVal e As
System.EventArgs)
' do something
End Sub

Try this
 
sorry, i am a total newb. so i must ask again...
i have attached the handler successfully (thanks!!!) but how can i
access the click event? lnkButton.Click doesn´t work??? how can i
raise the click event???

sorry, but i am a bloody beginner... :roll:

Apollo0130
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top