Link to home
Create AccountLog in
Avatar of faridos
faridos

asked on

how can I find the itemindex in a datalist whilst I am in the item template

Given a datalist and has the item template populated with a textbox and a Button
I want to pressthe button so the form will display the value found in the textbox
many proposals say

((TextBox)DataList.Items(item_index).FindControl("StudentID")).Text;

the question is how can I find the item_index of this datalis

Thanks you for any help provided

Fred
Avatar of avnish_tanna
avnish_tanna
Flag of India image

Avatar of faridos
faridos

ASKER

Thank you Avnish, but this will not solve the qustion onhand. On the same cell (amongst other 10 cells in a datalist) I have label1 and textbox1 and command 1. I want to click on commans1 click event and want it to display the value in textbox1 of that specificly selected cell. so I am not in the selectedvalue stage here, I am interpreting values withing the cell itself. Hope this clarifies it more.
All reseraches I am making are pointing to this type of solution
((TextBox)DataList.Items(item_index).FindControl("StudentID")).Text;
HOw can I get this item_index valu whilst I a m in the cell
ASKER CERTIFIED SOLUTION
Avatar of avnish_tanna
avnish_tanna
Flag of India image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of faridos

ASKER

Thank you Avinsh the post helped and fixed what I was looking for. I have another question in a different post, maybe you can help me figure this out
https://www.experts-exchange.com/questions/24193889/How-to-make-the-selected-index-of-a-gridview-residing-inside-a-datalist-to-act-like-a-command-select.html?cid=239&anchorAnswerId=23819597#a23819597
Any assistance in that is also appreciated