Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grid Item double click 1

Status
Not open for further replies.

kurie

Programmer
Jun 4, 2008
170
ZA
hi
I have a datagrid and in it i have put a textbox using the template items and i assign the value of the item ID to the textbox and its working fine, but i want to do a double click on a row and would like to return the value in the text box. I have added an attribute in the itemdatabound event as shown below. My problem is, if i double click my javascript alert function keeps returning the same value.
Does anyone know what im doing wrong.

protected void rdgAccounts_ItemDataBound1(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item)
{
string text = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("txt")).Text;
rdgAccounts.Attributes.Add("ondblclick", "return OpenGrid('" + text + "');");
}
}


function OpenGrid(txt2)
{
alert(txt2);
}


 
the problem is your putting the attribute on rdgAccounts which is the whole grid, not the individual rows. you need to traverse the txt control's parents until you reach the TR node/dom object and set the attribute there.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Thanks very much Jmeckey.

you have always been of much help to me, i really apreciate that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top