DataGrid edit issue...

Netnoobie

Well-known member
Joined
Feb 6, 2003
Messages
94
Location
Philadelphia
This might be hard to explain, but Ill try the best I can.

I have a DataGrid that can contain X number of rows. Going into the edit mode, three dropdown lists also have an INPUT box associated with them for use (for the most part) with Dennis Wests "fastkey" method (http://www.aspalliance.com/dotnetsolutions/Article2tmpl.aspx).

The problem Im having is that in the HTML portion of the page I create the INPUT box and assign the KeyUp event to go to the JScript function like:
Code:
<EditItemTemplate>
  <INPUT type="text" ID="txtfind" name="txtfind" size="9" [b]onKeyUp="findText(this, DataGrid1__[i]ctl2_[/i]selContainerName);"[/b]>
  <asp: DropDownList id="selContainerName" [i]...rest of stuff...[/i] />
</EditItemTemplate>

Now you can see that in creating this even I have to tell the INPUT what item is getting passed into the function (DataGrid__control_DDL). This is where the problem is. The entire thing works great for the first row because I have told the INPUT to go to the first row. However, any row after that fails because I need to be at row 3 (ctl3), for example, and the INPUT is still looking at the hard coded row and item.

My question is, how can I create a way for the INPUT code to increment for each row created. This would give me the way to have the ctl numbers reflect the DataGrid rows in which they are tied to.

Im not sure thats a good explanation, so I can go into more detail if needed. I just cant seem to think of a way in which I can create the INPUTS for each item and have the ctl number reflect the proper DataGrid row that I need.

If you have done anything like this please let me know. I just need to be pointed in the right direction because Im just spinning my wheels on this right now.

Many Thanks!
Bryan
 
This is my suggestion:

What about if you change your HTML Control (INPUT) to Web Control (ASP:)? then use "ControlID.Attribute.Add" to assign your "onKeyUp=..."? In this case you can put anything in your parameters.

Is it solve your problem?
 
Haiya! forum automatic change my symbols to smile face... actually I am not using that, because Web Control always start with "ASP:dropdownlist...", so that it only my example. If you convert back that smile image back to characters ":" and ")", then you might understand. (hope I did not make you confuse)
 
i tried that once before and it didnt work for some reason, but i dont think i used the "ControlID.Attribute.Add". Ill give that a try today and let you know.

Thanks!
Bryan
 
Back
Top