help needed

Discussion in 'ASP .Net' started by nil, Nov 30, 2006.

  1. nil

    nil Guest

    hello all...
    i did one coding to bind an image in the datagrid but the problem is
    that it binds every
    image control with the last image in the dataset...actually i am
    storing path in the oracle.



    here's the coding that i did..

    private sub dg_itembound(byval sender as object,byval e as
    system.web.ui.webcontrols.datagriditemeventargs) handles db.itembound

    dim i as integer

    dim img as image

    dim str as string

    str="Select image from member_data where " & ddltype.selectitem.value &
    "like initcap('"& txtsrch.text &"%')"

    ds=dbconn(str)

    for i=0 to ds.tables(0).rows.count-1 step 1

    if e.item.itemtype=listitemtype.alteringitem or
    e.item.itemtype=listitemtype.item then

    img=ctype(e.item.cells(1).controls(1),system.web.ui.webcontrols.image)

    img.imageurl=ds.tables(0).rows(i).item("item")

    end if
    next
    end sub

    i did above coding as when user searches for his profile by name..then
    there may be more then one name user so i want to bind
    the image in the grid..so please help me out..thanks in advance
     
    nil, Nov 30, 2006
    #1
    1. Advertising

  2. That would be because the select condition for your sql never changes
    -- it is always txtsrch.text

    Is it possible to rewrite the query such that it fetches the image url
    for each returned row?

    On 30 Nov 2006 03:24:42 -0800, "nil" <>
    wrote:

    >hello all...
    >i did one coding to bind an image in the datagrid but the problem is
    >that it binds every
    >image control with the last image in the dataset...actually i am
    >storing path in the oracle.
    >
    >
    >
    >here's the coding that i did..
    >
    >private sub dg_itembound(byval sender as object,byval e as
    >system.web.ui.webcontrols.datagriditemeventargs) handles db.itembound
    >
    >dim i as integer
    >
    >dim img as image
    >
    >dim str as string
    >
    >str="Select image from member_data where " & ddltype.selectitem.value &
    >"like initcap('"& txtsrch.text &"%')"
    >
    >ds=dbconn(str)
    >
    > for i=0 to ds.tables(0).rows.count-1 step 1
    >
    > if e.item.itemtype=listitemtype.alteringitem or
    >e.item.itemtype=listitemtype.item then
    >
    > img=ctype(e.item.cells(1).controls(1),system.web.ui.webcontrols.image)
    >
    > img.imageurl=ds.tables(0).rows(i).item("item")
    >
    > end if
    > next
    >end sub
    >
    >i did above coding as when user searches for his profile by name..then
    >there may be more then one name user so i want to bind
    >the image in the grid..so please help me out..thanks in advance

    --

    Bits.Bytes.
    http://bytes.thinkersroom.com
     
    Rad [Visual C# MVP], Nov 30, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. andy

    urgent help needed !

    andy, Jul 12, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    924
  2. Thomas Nick
    Replies:
    0
    Views:
    1,936
    Thomas Nick
    Jun 13, 2005
  3. Ryan Macy

    Ideas needed & help needed!

    Ryan Macy, Jul 19, 2006, in forum: Ruby
    Replies:
    2
    Views:
    530
    Ryan Macy
    Jul 19, 2006
  4. LeTubs
    Replies:
    6
    Views:
    132
    Tad McClellan
    Jan 25, 2004
  5. John Farold
    Replies:
    0
    Views:
    397
    John Farold
    Aug 29, 2012
Loading...

Share This Page