PDA

Click to See Complete Forum and Search --> : [RESOLVED][1.0/1.1] Can anyone help me stop the blink?


MetaEdgeDanny
Jun 26th, 2007, 03:47 AM
The following code I have included here is C# that's written into .ASP, what it does is that every time I change the text within Report ID textbox (TextBoxRptid), it will go and make sure that the Table Name textbox (TextBoxTn) will be changed as well. But, there's a problem: Every time I change the value in TextBoxRptid, the page is reloaded which creates a short blink of the screen. And it's really annoying, so does anyone know of any other ways to write the following code to remove the reload of the page or blink?

private void TextBoxRptid_TextChanged(object sender, System.EventArgs e)
{
// Tablename = Report ID
TextBoxTn.Text=TextBoxRptid.Text;
}

PS: I know I can create another button and do the function when I click it, but I need something else. Since the users may not always remember to click the button before adding data.

Harsh Gupta
Jun 26th, 2007, 04:12 AM
You are doing it at server side, that is why it is refreshing after every keypress. You need to do it at client side, using Javascript.

//Your text boxes
<asp:TextBox id="TextBoxRptid" runat="server" onkeyup="changeTN()" />
<br/>
<asp:TextBox id="TextBoxTn" runat="server" />

//JS Code
<script type="text/javascript">
function changeTN()
{
document.getElementById('TextBoxTn').value = document.getElementById('TextBoxRptid').value;
}
</script>

MetaEdgeDanny
Jun 26th, 2007, 04:15 AM
forgot to mention I had AutoPostBack on, but regardless, only having the user load the script on its computer (client side), it will cause this problem :(

thanks for the heads up.