Re: ImageButton

From: Martin Dechev (detcheff__at_hotmail.com)
Date: 09/21/04


Date: Tue, 21 Sep 2004 16:38:29 +0200

Hi,

A database query for a single row should not result in heavy load in this
case. So I suggest you do it in this way.

Greetings
Martin
"simon" <simon.zupan@stud-moderna.si> wrote in message
news:#YJnHa#nEHA.3464@tk2msftngp13.phx.gbl...
> well, I don't have data source on the server side, because SQL server is
> much faster than the tables on the server side.
> And there is complication with updates to the database and you need more
> time for development (time is anyway 2 times greater than in asp) and so
on.
> So, I don't have dataSource on the server.
>
> Anyway, go back to the database and pick the data again is the best
> solution?
>
> No other way?
>
> Thank you,
> Simon
>
> "Martin Dechev" <detcheff_@hotmail.com> wrote in message
> news:eg8ko%239nEHA.2904@TK2MSFTNGP15.phx.gbl...
> > Hi, Simon,
> >
> > I suggest you keep the DataSource you're binding to on the server side
and
> > just set one (or two) identifying parameters for CommandName (and/or
> > CommangArgument) and then look up the rest from the data in the
> DataSource.
> >
> > Hope this helps
> > Martin
> > "simon" <simon.zupan@stud-moderna.si> wrote in message
> > news:e$wwO49nEHA.3712@TK2MSFTNGP15.phx.gbl...
> > > Thank you,
> > >
> > > that works. But what if I want to put more than 2 parameters into the
> > click
> > > or command event?
> > > For example:
> > >
> > > <asp:imagebutton id="imageButton1"
> > > onCommand='<%# mySub(DataBinder.Eval(Container.DataItem,
> > > "dayName"),DataBinder.Eval(Container.DataItem,
> > > "timeStart"),DataBinder.Eval(Container.DataItem,
> > > "timeEnd"),DataBinder.Eval(Container.DataItem,
> > > "Price"),DataBinder.Eval(Container.DataItem,
> > > "Flexibility"),DataBinder.Eval(Container.DataItem,
> > > "idDay"),DataBinder.Eval(Container.DataItem,
> > > "mType_name"),DataBinder.Eval(Container.DataItem, "maxNo"))%>'
> > runat=server>
> > >
> > > In your example you can get only one value from commandName and one
from
> > > commandArgument.
> > >
> > > Or with other words, how you can pass or read more than 2 parameters
to
> > your
> > > function :
> > > Protected Sub imageButton1_Command( s As object, e As
CommandEventArgs)
> > > Dim hourId As Integer = Convert.ToInt32(e.CommandName)
> > > Dim timeStart As DateTime = DateTime.Parse(e.CommandArgument)
> > > Dim timeEnd As DateTime = ????
> > > Dim Price as Decimal=????
> > > ....
> > > .....
> > > and so on....
> > > end sub
> > >
> > > I hope you understand me, what I need?
> > >
> > > Thank you,
> > > Simon
> > >
> > > "Martin Dechev" <detcheff_@hotmail.com> wrote in message
> > > news:%23enNFc9nEHA.3908@TK2MSFTNGP09.phx.gbl...
> > > > Hi, Simon,
> > > >
> > > > You can try handling the Command event instead. Something like:
> > > >
> > > > <asp:imagebutton id="imageButton1" oncommand="imageButton1_Command"
> > > > commandname='<%# DataBinder.Eval(Container.DataItem, "dayId")%>'
> > > > commandargument='<%# deleteHour(DataBinder.Eval(Container.DataItem,
> > > > "timeStart")%>'
> > > > .../>
> > > >
> > > > ----------------------------------------------
> > > >
> > > > Protected Sub imageButton1_Command( _
> > > > s As object, e As CommandEventArgs)
> > > >
> > > > Dim hourId As Integer = _
> > > > Convert.ToInt32(e.CommandName)
> > > > Dim timeStart As DateTime = _
> > > > DateTime.Parse(e.CommandArgument)
> > > >
> > > > ...
> > > > End Sub
> > > >
> > > > Hope this helps
> > > > Martin
> > > > "simon" <simon.zupan@stud-moderna.si> wrote in message
> > > > news:uSWtYb7nEHA.1160@tk2msftngp13.phx.gbl...
> > > > I would like that when user clicks the imageButton, the sub with one
> or
> > > more
> > > > parameters is executed, something like this:
> > > > (the image button is in data repeater)
> > > >
> > > > I have imageButton:
> > > >
> > > > <asp:ImageButton OnClick='<%#
> > > > deleteHour(DataBinder.Eval(Container.DataItem,
> > > > "dayId"),DataBinder.Eval(Container.DataItem, "timeStart"))'
> > > > ImageUrl="../images/brisi.gif" Runat="server"
> > > > ID="btnDelHour"></asp:ImageButton>
> > > >
> > > >
> > > > and sub :
> > > >
> > > > Public Sub deleteHour(ByVal hourId As Integer,byval timeStart as
> > datetime)
> > > > Dim sql As String
> > > > ...
> > > > ....
> > > > End Sub
> > > >
> > > > Why this doesn't work and what is the right code?
> > > >
> > > > Thank you,
> > > > Simon
> > > >
> > > >
> > >
> > >
> >
> >
>
>