|
-
Mar 25th, 2007, 11:52 AM
#1
Thread Starter
Addicted Member
grid + textbox + autopostback + javascript focus
I have a grid with text box,
I change the text box to be AutoPostBack="true"
when I change the data I have event that insert the data to the DB.
Code:
protected void mark_TextChanged(object sender, EventArgs e)
{
TextBox t = (TextBox)sender;
GridViewRow grdRow = (GridViewRow)t.Parent.Parent;
Label l = (Label)grdRow.FindControl("questionID");
// HERE I INSERT THE DATA TO THE DB
//TRY TO GO TO THE TEXT BOX IN THE NEXT ROW
grdRow = new GridViewRow(grdRow.RowIndex + 1,grdRow.DataItemIndex,DataControlRowType.DataRow, DataControlRowState.Normal);
l = (Label)grdRow.FindControl("questionID"); //BREAK HERE
Page.ClientScript.RegisterStartupScript(this.GetType(), "aaa", "document.getElementById('" + l.ClientID + "').focus()", true);
how can I go th the next row in the grid.
thanks!
-
Mar 26th, 2007, 10:00 AM
#2
Re: grid + textbox + autopostback + javascript focus
Isn't that going to be super inefficiant, because every keystroke in your text box will result in a call to the db?
-
Mar 27th, 2007, 08:04 AM
#3
Re: grid + textbox + autopostback + javascript focus
Add an 'update' or 'insert' column to your grid. Let the user type into the textbox in peace and have him click the update button to perform the database transaction.
-
Mar 27th, 2007, 08:05 AM
#4
Re: grid + textbox + autopostback + javascript focus
That will also take care of the 'next' row, as an update button exists for each row in the grid.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|