asp.net - 2 listviews working together -


i have created asp.net page 2 listviews. 1 name , message date , 1 message in when click first highlight message in other listview don't know how work. hope somone give me hint here.

i have method first listview.

protected sub lswberichten2_selectedindexchanged(sender object, e eventargs) handles lswberichten2.selectedindexchanged      dim lblmsgid label = ctype(lswberichten2.items(lswberichten2.selectedindex).findcontrol("msgid"), label)     hiddenmessageid.value = lblmsgide.text          end sub 

im not entirely sure looking for, im not sure intent entirely clear. believe binding data 2 lists (i assume same datasource, different fields), , when item in list 1 selected, corresponding item in list 2 selected. here take:

first listboxes must have data assigned; binding display , value differently, can allow data id field included.

listbox1.datasource = yourdatasource; listbox1.valuemember = youridfield; listbox1.displaymember = yourmessageoverview;  listbox2.datasource = yourdatasource; listbox2.valuemember = youridfield; listbox2.displaymember = yourmessagetext; 

then when selection changed, establish id of selected item is, search second list item same value.

protected void listbox1_selectedindexchanged(object sender, eventargs e) {      string val = (listbox1.selecteditem datarowview)["columnname"].tostring();      listbox2.items.findbyvalue(val).selected = true; } 

i have not checked code, assume should not have many issues.

also apologise c# response vb question, has been years since worked in vb.

changed selected item value retrieval in accordance stack answer, helps?


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -