How can i keep the value of a textbox after postback

I am not sure if i should ask this in front-end or back-end. But here it goes: I am developing a website using asp.net and c#. I have a section where i can see the feedbacks in a html table. And every row has three actions: auto-respond, respond and delete. Auto-respond and delete actions work and for respond, there is a problem. If i choose respond (Cevapla) (which is for custom respond) a section becomes visible. In that section there are three textboxes and two buttons. I set the value of TextBox1 by using a js function which takes the value of selected row's second column (email address). Other two are for subject and message. One button is html button for cancel. The other one is an asp button for send email. The problem is when i click send button the page loads again (AutoPostBack) and the value of TextBox1 (which i get from js function) becomes "". How can i keep the value of TextBox1 after postback? Frontend code is attached. Website's language is Turkish and i translate some content to english (such as buttons in question) but if there is a part needs translating please tell me. And for backend i have a Button_Click:
protected void Button1_Click(object sender, EventArgs e)
{
string alici = Request.Form["alici"];
string baslik = Request.Form["baslik"];
string mesaj = Request.Form["mesaj"];

Email email = new Email();
email.cevapla(alici, baslik, mesaj);
gonderildi.Visible = true;
}
protected void Button1_Click(object sender, EventArgs e)
{
string alici = Request.Form["alici"];
string baslik = Request.Form["baslik"];
string mesaj = Request.Form["mesaj"];

Email email = new Email();
email.cevapla(alici, baslik, mesaj);
gonderildi.Visible = true;
}
Thank you
1 Reply
ceyda
ceydaOP11mo ago
I've tried a couple of ways so the frontend may be a bit complicated
Want results from more Discord servers?
Add your server