asp.net - Getting checkboxList values as per selected category from parent checkboxList -
i trying fetch checkboxlist database (working). there 2 checkboxlist on page: first gets fetch when page loads, second gets fetched selected values first checkboxlist. working when select first time first checkboxlist. when select second value first checkboxlist string gets structured
('value1','value2 " & vblf & "')
it should make string this
('value1','value2')
now don't understand & vblf &
.
dim joiner string = "" dim whereclause string = string.empty dim categorycondition string = string.empty = 0 categoryfilter.items.count - 1 if categoryfilter.items(i).selected dim category string = categoryfilter.items(i).tostring categorycondition = string.concat(categorycondition, joiner, string.format("'{0}'", category)) if joiner = "" joiner = "," end if next
use built-in functionality checked items , concatenate string linq
- get checked items control (
categoryfilter.checkeditems
) - convert them string (
cast(of string)()
) - put
'
around them individually (select()
) - join them
,
(aggregate()
)
code:
dim categorycondition string = me.categoryfilter.checkeditems. cast(of string)(). select(function(i1) string.format("'{0}'", i1)). aggregate(function(i1, i2) string.format("{0}, {1}", i1, i2))
if line feed still exists, it's probable exists in checkedlistbox
items itself. said that's coming database, maybe that's (not working).
Comments
Post a Comment