Urgent: Trigger javascript function after bind control

G

Guest

Hi All,

I've a problem here, I want to trigger a javascript function after binding
the ListBox control. Basically the javascript will remove the duplicates
records after recordset is bind in the ListBox control automatically without
users onclick/onchange the ListBox.

I don't want to distinct the records in the SQL query, because I have other
usage for those duplicates records.

How can this be done? Please help, thanks in advance.
 
R

Richard Brown

Ken said:
Hi Mae,

Does it have to be client-side and right after binding the control?

It's hard to get into a server-side event like that to do client-side stuff.

Why not loop through the items collection on the server-side to remove the
duplicates?

Or, what about running the JavaScript immediately after the page is loaded?
That's far safer:

http://msdn2.microsoft.com/en-us/li...lientscriptmanager.registerstartupscript.aspx

Ken
Microsoft MVP [ASP.NET]

Mae Lim said:
Hi All,

I've a problem here, I want to trigger a javascript function after binding
the ListBox control. Basically the javascript will remove the duplicates
records after recordset is bind in the ListBox control automatically
without
users onclick/onchange the ListBox.

I don't want to distinct the records in the SQL query, because I have
other
usage for those duplicates records.

How can this be done? Please help, thanks in advance.

Can you not use two SQL queries one that returns distinct rows and one
that doesn't and use them accordingly.
 
B

Bill Gregg

Rather than maintaining 2 SPs, could you use the create a DataView from
the binded DataSet? In other words apply your DataView (where you
remove the duplicates) to the DataSet and then bind your list box to the
DataView?

Bill Gregg
MCP, MCAD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top