dear freinds... i have made a c# web application aned it is working properly in my computer... when i published it in the internet, it doesnt work as it should???!!!
in one page i must fill a page dynamically from sql tabel and it does. but each items has a linkbutton, that when you press on it, it should open a page with controls from a sql tabel, but the page is not opened and the current page becomes empty???!!!
my codes are as follow:
protected void FillPage(int rowind)
{ ...... LinkButton adtitle = new LinkButton();
adtitle.Text = "Title:" + rowind.ToString() + ":" + GridView1.Rows[rowind].Cells[4].Text;
title[rowind] = GridView1.Rows[rowind].Cells[4].Text;
tcell_3.Controls.Add(adtitle);
trow_3.Controls.Add(tcell_3);
mytable.Controls.Add(trow_3);
adtitle.Click += new EventHandler(adtitle_Click);
this.form2.Controls.Add(adtitle);
.....}
private void adtitle_Click(object sender, EventArgs e)
{
//LinkButton adtitle = sender as LinkButton;
LinkButton adtitle = (LinkButton)sender;
var s = adtitle.Text.Split(':');
int nn = Convert.ToInt32(s[1]);
visitors[nn] = m[nn];
Session["nr"] = nr[nn];
Session["name"] = "";
Session["email"] = Email[nn];
Session["title"] = title[nn];
Session["message"] = "Ad registered!";
Session["visitors"] = visitors[nn].ToString();
Server.Transfer("adpage.aspx");
}
it works on my computer, but not in the internet???!!!
i cannot put the codes in the Page_Load... i appreciate any help, greateful with complete codes... kind regards
venus najadPosted Nov 3, 2023, 11:54 AM
hello... i solved the probloem by my own:
created page_init and put an invisible control, then your linkbutton in the other method/function works
venus najadPosted Oct 30, 2023, 6:32 PM
hello Marius and thansk for yor respond, but it doesnt work... besides i have another pages which connect to other pages without any problems... the dynamic linkbutton doesnt invoke the click function??!!
Marius VasilePosted Oct 30, 2023, 4:40 PM
The line
Server.Transfer("adpage.aspx");
should have a correct address. try with
Server.Transfer("/adpage.aspx");
or if you have folders
Server.Transfer("/Folder/adpage.aspx");