Ask a Question related to ASP.NET General, Design and Development.
-
Hrvoje Vrbanc #1
problems with client scripting invoked from DataGrid OnItemDataBoundEvent
Hello,
I have the following problem:
I have a DataGrid control on my page with a column with TextBox controls and
another one with ImageButton controls. In order to force a call to
JavaScript client-side script when ImageButton is pressed, I added the
following code to OnItemDataBoundEvent (check for Item Types not shown
here):
Dim tbKolicina As TextBox = e.Item.Cells(6).FindControl("tbKolicina")
Dim imgbtKosarica As ImageButton =
e.Item.Cells(7).FindControl("imgbtKosarica")
imgbtKosarica.Attributes.Add("onClick", "return validacija('" &
tbKolicina.Text & "')")
"tbKolicina" is the TextBox control whose value I want to pass to JavaScript
for validation when ImageButton called "imgbtKosarica" is clicked.
JavaScript is currently just an elementary script (no validation yet) and
should simply display an alert box with the passed parameter
(tbKolicinaText) displayed when the ImageButton is clicked.
It works fine (finds the controls and calls the JavaScript) up to one final
point: the value of the TextBox (tbKolicina.text) doesn't reach the
JavaScript script. Whatever I write into the TextBox, I receive an empty
alert box. But, if I set the value for the tbKolicina.text programatically,
that value does get passed. I concluded therefore that only the initial
value reaches JavaScript.
What did I do wrong and how could I make this validation work?
Thank you in advance,
Hrvoje
Hrvoje Vrbanc Guest
-
How to prevent our client from using Scripting.FileSystemObject
I offer web space for our client to host their website. We offer them to upload asp files. How can we prevent our client to upload asp files wSet... -
Help needed with DataGrid Client-Side Scripting
Hi, I have a custom ASP.Net DataGrid Control which has DropDownLists in each of the HeaderCells of the Grid. I'm not able to get the ClientID... -
Client side and server side scripting problem
Hiya I have a problem with using some client side and server side scripting together in an ASP. I'm using VBScript. What I'm trying to achieve... -
Scripting.FileSystemObject problems
If I comment #2 to #5 no problems. If I uncomment #2, #4 and #5 the page hangs. Even did not reach the point to uncomment #3 So, whats wrong. Do i... -
Getting the name of an invoked method?
Hello, In the C Ruby API, is there a clean way to get the name of the method which has been invoked? ie. If there is a single C function... -
Vidar Petursson #2
Re: problems with client scripting invoked from DataGrid OnItemDataBoundEvent
Hi
This should pass the value of tbKolicina field to the function
imgbtKosarica.Attributes.Add("onclick", "return
validacija(this.form.tbKolicina.value)")
--
Best Regards
Vidar Petursson
==============================
Microsoft Internet Client & Controls MVP
==============================
"Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
news:%23RYeHfaXDHA.1644@TK2MSFTNGP10.phx.gbl...and> Hello,
>
> I have the following problem:
> I have a DataGrid control on my page with a column with TextBox controlsJavaScript> another one with ImageButton controls. In order to force a call to
> JavaScript client-side script when ImageButton is pressed, I added the
> following code to OnItemDataBoundEvent (check for Item Types not shown
> here):
>
> Dim tbKolicina As TextBox = e.Item.Cells(6).FindControl("tbKolicina")
> Dim imgbtKosarica As ImageButton =
> e.Item.Cells(7).FindControl("imgbtKosarica")
> imgbtKosarica.Attributes.Add("onClick", "return validacija('" &
> tbKolicina.Text & "')")
>
> "tbKolicina" is the TextBox control whose value I want to pass tofinal> for validation when ImageButton called "imgbtKosarica" is clicked.
> JavaScript is currently just an elementary script (no validation yet) and
> should simply display an alert box with the passed parameter
> (tbKolicinaText) displayed when the ImageButton is clicked.
>
> It works fine (finds the controls and calls the JavaScript) up to oneprogramatically,> point: the value of the TextBox (tbKolicina.text) doesn't reach the
> JavaScript script. Whatever I write into the TextBox, I receive an empty
> alert box. But, if I set the value for the tbKolicina.text> that value does get passed. I concluded therefore that only the initial
> value reaches JavaScript.
>
> What did I do wrong and how could I make this validation work?
>
> Thank you in advance,
> Hrvoje
>
>
Vidar Petursson Guest
-
Hrvoje Vrbanc #3
Re: problems with client scripting invoked from DataGrid OnItemDataBoundEvent
Vidar,
thank you for the advice.
Unfortunately, it still doesn't work - it displays error message within the
alert box: "'this.form.tbKolicina.value' is null or not an
object"....somehow it doesn't recognize it.
Hrvoje
"Vidar Petursson" <theking@icysoft.com> wrote in message
news:OYZX$oaXDHA.888@TK2MSFTNGP10.phx.gbl...and> Hi
>
> This should pass the value of tbKolicina field to the function
> imgbtKosarica.Attributes.Add("onclick", "return
> validacija(this.form.tbKolicina.value)")
>
> --
> Best Regards
> Vidar Petursson
> ==============================
> Microsoft Internet Client & Controls MVP
> ==============================
> "Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
> news:%23RYeHfaXDHA.1644@TK2MSFTNGP10.phx.gbl...> and> > Hello,
> >
> > I have the following problem:
> > I have a DataGrid control on my page with a column with TextBox controls> JavaScript> > another one with ImageButton controls. In order to force a call to
> > JavaScript client-side script when ImageButton is pressed, I added the
> > following code to OnItemDataBoundEvent (check for Item Types not shown
> > here):
> >
> > Dim tbKolicina As TextBox = e.Item.Cells(6).FindControl("tbKolicina")
> > Dim imgbtKosarica As ImageButton =
> > e.Item.Cells(7).FindControl("imgbtKosarica")
> > imgbtKosarica.Attributes.Add("onClick", "return validacija('" &
> > tbKolicina.Text & "')")
> >
> > "tbKolicina" is the TextBox control whose value I want to pass to> > for validation when ImageButton called "imgbtKosarica" is clicked.
> > JavaScript is currently just an elementary script (no validation yet)> final> > should simply display an alert box with the passed parameter
> > (tbKolicinaText) displayed when the ImageButton is clicked.
> >
> > It works fine (finds the controls and calls the JavaScript) up to one> programatically,> > point: the value of the TextBox (tbKolicina.text) doesn't reach the
> > JavaScript script. Whatever I write into the TextBox, I receive an empty
> > alert box. But, if I set the value for the tbKolicina.text>> > that value does get passed. I concluded therefore that only the initial
> > value reaches JavaScript.
> >
> > What did I do wrong and how could I make this validation work?
> >
> > Thank you in advance,
> > Hrvoje
> >
> >
>
Hrvoje Vrbanc Guest
-
Vidar Petursson #4
Re: problems with client scripting invoked from DataGrid OnItemDataBoundEvent
Hi
Make sure the field is there and you have the name spelled correctly ( case
sensitive )
--
Best Regards
Vidar Petursson
==============================
Microsoft Internet Client & Controls MVP
==============================
"Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
news:uNYA4waXDHA.1384@TK2MSFTNGP10.phx.gbl...the> Vidar,
>
> thank you for the advice.
> Unfortunately, it still doesn't work - it displays error message withincontrols> alert box: "'this.form.tbKolicina.value' is null or not an
> object"....somehow it doesn't recognize it.
>
> Hrvoje
>
>
> "Vidar Petursson" <theking@icysoft.com> wrote in message
> news:OYZX$oaXDHA.888@TK2MSFTNGP10.phx.gbl...> > Hi
> >
> > This should pass the value of tbKolicina field to the function
> > imgbtKosarica.Attributes.Add("onclick", "return
> > validacija(this.form.tbKolicina.value)")
> >
> > --
> > Best Regards
> > Vidar Petursson
> > ==============================
> > Microsoft Internet Client & Controls MVP
> > ==============================
> > "Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
> > news:%23RYeHfaXDHA.1644@TK2MSFTNGP10.phx.gbl...> > > Hello,
> > >
> > > I have the following problem:
> > > I have a DataGrid control on my page with a column with TextBoxempty> and> > and> > JavaScript> > > another one with ImageButton controls. In order to force a call to
> > > JavaScript client-side script when ImageButton is pressed, I added the
> > > following code to OnItemDataBoundEvent (check for Item Types not shown
> > > here):
> > >
> > > Dim tbKolicina As TextBox = e.Item.Cells(6).FindControl("tbKolicina")
> > > Dim imgbtKosarica As ImageButton =
> > > e.Item.Cells(7).FindControl("imgbtKosarica")
> > > imgbtKosarica.Attributes.Add("onClick", "return validacija('" &
> > > tbKolicina.Text & "')")
> > >
> > > "tbKolicina" is the TextBox control whose value I want to pass to> > > for validation when ImageButton called "imgbtKosarica" is clicked.
> > > JavaScript is currently just an elementary script (no validation yet)> > final> > > should simply display an alert box with the passed parameter
> > > (tbKolicinaText) displayed when the ImageButton is clicked.
> > >
> > > It works fine (finds the controls and calls the JavaScript) up to one> > > point: the value of the TextBox (tbKolicina.text) doesn't reach the
> > > JavaScript script. Whatever I write into the TextBox, I receive aninitial> > programatically,> > > alert box. But, if I set the value for the tbKolicina.text> > > that value does get passed. I concluded therefore that only the>> >> > > value reaches JavaScript.
> > >
> > > What did I do wrong and how could I make this validation work?
> > >
> > > Thank you in advance,
> > > Hrvoje
> > >
> > >
> >
>
Vidar Petursson Guest
-
vrba #5
Re: problems with client scripting invoked from DataGrid OnItemDataBoundEvent
Hello and thank you, John.
As alert box shows, nothing was put in JavaScript, i.e., the source says
onclick="return validacija('')", just as if the text box was empty (no value
for the parameter). Funny, but the same source shows correct value in the
text box parameters, e.g. <input name="dgProdukti:_ctl4:tbKolicina"
type="text" value="711" id="dgProdukti__ctl4_tbKolicina" />, 711 being the
entered number that doesn't reach the JavaScript....
Funny!
Hrvoje
"John Saunders" <john.saunders@surfcontrol.com> wrote in message
news:#L08TIbXDHA.2632@TK2MSFTNGP09.phx.gbl...the> Hrvoje,
>
> Take a look at the generated HTML with View Source in IE. Look to see what
> was put into your JavaScript.
> -- .e.
> John Saunders
> Internet Engineer
> [email]john.saunders@surfcontrol.com[/email]
>
> "Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
> news:uNYA4waXDHA.1384@TK2MSFTNGP10.phx.gbl...> the> > Vidar,
> >
> > thank you for the advice.
> > Unfortunately, it still doesn't work - it displays error message within> controls> > alert box: "'this.form.tbKolicina.value' is null or not an
> > object"....somehow it doesn't recognize it.
> >
> > Hrvoje
> >
> >
> > "Vidar Petursson" <theking@icysoft.com> wrote in message
> > news:OYZX$oaXDHA.888@TK2MSFTNGP10.phx.gbl...> > > Hi
> > >
> > > This should pass the value of tbKolicina field to the function
> > > imgbtKosarica.Attributes.Add("onclick", "return
> > > validacija(this.form.tbKolicina.value)")
> > >
> > > --
> > > Best Regards
> > > Vidar Petursson
> > > ==============================
> > > Microsoft Internet Client & Controls MVP
> > > ==============================
> > > "Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
> > > news:%23RYeHfaXDHA.1644@TK2MSFTNGP10.phx.gbl...
> > > > Hello,
> > > >
> > > > I have the following problem:
> > > > I have a DataGrid control on my page with a column with TextBox> > > and
> > > > another one with ImageButton controls. In order to force a call to
> > > > JavaScript client-side script when ImageButton is pressed, I addedshown> > > > following code to OnItemDataBoundEvent (check for Item Types note.Item.Cells(6).FindControl("tbKolicina")> > > > here):
> > > >
> > > > Dim tbKolicina As TextBox =yet)> > > > Dim imgbtKosarica As ImageButton =
> > > > e.Item.Cells(7).FindControl("imgbtKosarica")
> > > > imgbtKosarica.Attributes.Add("onClick", "return validacija('" &
> > > > tbKolicina.Text & "')")
> > > >
> > > > "tbKolicina" is the TextBox control whose value I want to pass to
> > > JavaScript
> > > > for validation when ImageButton called "imgbtKosarica" is clicked.
> > > > JavaScript is currently just an elementary script (no validationone> > and> > > > should simply display an alert box with the passed parameter
> > > > (tbKolicinaText) displayed when the ImageButton is clicked.
> > > >
> > > > It works fine (finds the controls and calls the JavaScript) up to> empty> > > final
> > > > point: the value of the TextBox (tbKolicina.text) doesn't reach the
> > > > JavaScript script. Whatever I write into the TextBox, I receive an> initial> > > > alert box. But, if I set the value for the tbKolicina.text
> > > programatically,
> > > > that value does get passed. I concluded therefore that only the>> >> > > > value reaches JavaScript.
> > > >
> > > > What did I do wrong and how could I make this validation work?
> > > >
> > > > Thank you in advance,
> > > > Hrvoje
> > > >
> > > >
> > >
> > >
> >
>
vrba Guest
-
John Saunders #6
Re: problems with client scripting invoked from DataGrid OnItemDataBoundEvent
I just took a quick look back at your code. You're taking the value out of
the TextBox in OnItemDataBound, but when did you put a value _into_ the
TextBox?
--
John Saunders
Internet Engineer
[email]john.saunders@surfcontrol.com[/email]
"vrba" <hrvojev@recro.hr> wrote in message
news:OCRbAodXDHA.1580@tk2msftngp13.phx.gbl...value> Hello and thank you, John.
>
> As alert box shows, nothing was put in JavaScript, i.e., the source says
> onclick="return validacija('')", just as if the text box was empty (nowhat> for the parameter). Funny, but the same source shows correct value in the
> text box parameters, e.g. <input name="dgProdukti:_ctl4:tbKolicina"
> type="text" value="711" id="dgProdukti__ctl4_tbKolicina" />, 711 being the
> entered number that doesn't reach the JavaScript....
> Funny!
>
> Hrvoje
>
>
> "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> news:#L08TIbXDHA.2632@TK2MSFTNGP09.phx.gbl...> > Hrvoje,
> >
> > Take a look at the generated HTML with View Source in IE. Look to seewithin> > was put into your JavaScript.
> > -- .e.
> > John Saunders
> > Internet Engineer
> > [email]john.saunders@surfcontrol.com[/email]
> >
> > "Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
> > news:uNYA4waXDHA.1384@TK2MSFTNGP10.phx.gbl...> > > Vidar,
> > >
> > > thank you for the advice.
> > > Unfortunately, it still doesn't work - it displays error messagethe> the> > the> > controls> > > alert box: "'this.form.tbKolicina.value' is null or not an
> > > object"....somehow it doesn't recognize it.
> > >
> > > Hrvoje
> > >
> > >
> > > "Vidar Petursson" <theking@icysoft.com> wrote in message
> > > news:OYZX$oaXDHA.888@TK2MSFTNGP10.phx.gbl...
> > > > Hi
> > > >
> > > > This should pass the value of tbKolicina field to the function
> > > > imgbtKosarica.Attributes.Add("onclick", "return
> > > > validacija(this.form.tbKolicina.value)")
> > > >
> > > > --
> > > > Best Regards
> > > > Vidar Petursson
> > > > ==============================
> > > > Microsoft Internet Client & Controls MVP
> > > > ==============================
> > > > "Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
> > > > news:%23RYeHfaXDHA.1644@TK2MSFTNGP10.phx.gbl...
> > > > > Hello,
> > > > >
> > > > > I have the following problem:
> > > > > I have a DataGrid control on my page with a column with TextBox> > > > and
> > > > > another one with ImageButton controls. In order to force a call to
> > > > > JavaScript client-side script when ImageButton is pressed, I added> shown> > > > > following code to OnItemDataBoundEvent (check for Item Types not> e.Item.Cells(6).FindControl("tbKolicina")> > > > > here):
> > > > >
> > > > > Dim tbKolicina As TextBox => yet)> > > > > Dim imgbtKosarica As ImageButton =
> > > > > e.Item.Cells(7).FindControl("imgbtKosarica")
> > > > > imgbtKosarica.Attributes.Add("onClick", "return validacija('" &
> > > > > tbKolicina.Text & "')")
> > > > >
> > > > > "tbKolicina" is the TextBox control whose value I want to pass to
> > > > JavaScript
> > > > > for validation when ImageButton called "imgbtKosarica" is clicked.
> > > > > JavaScript is currently just an elementary script (no validation> one> > > and
> > > > > should simply display an alert box with the passed parameter
> > > > > (tbKolicinaText) displayed when the ImageButton is clicked.
> > > > >
> > > > > It works fine (finds the controls and calls the JavaScript) up to> > > > final
> > > > > point: the value of the TextBox (tbKolicina.text) doesn't reach>> > empty> > > > > JavaScript script. Whatever I write into the TextBox, I receive an> > initial> > > > > alert box. But, if I set the value for the tbKolicina.text
> > > > programatically,
> > > > > that value does get passed. I concluded therefore that only the> >> > > > > value reaches JavaScript.
> > > > >
> > > > > What did I do wrong and how could I make this validation work?
> > > > >
> > > > > Thank you in advance,
> > > > > Hrvoje
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
John Saunders Guest
-
Hrvoje Vrbanc #7
Re: problems with client scripting invoked from DataGrid OnItemDataBoundEvent
Hello John,
hm, I thought that OnItemDataBound I just wire the script and that values
could be transferred later.....obviously a mistake. I was thinking about
that but if I put my code inside OnSelectedIndexChanged event, then the page
doesn't react on the first click (because only then is the script activated)
but only when the same ImageButton is clicked for the second time....
Therefore, it seems I need the new solution.
Thank you,
Hrvoje
"John Saunders" <john.saunders@surfcontrol.com> wrote in message
news:uVjYaLeXDHA.2312@TK2MSFTNGP10.phx.gbl...the> I just took a quick look back at your code. You're taking the value out of
> the TextBox in OnItemDataBound, but when did you put a value _into_ the
> TextBox?
> --
> John Saunders
> Internet Engineer
> [email]john.saunders@surfcontrol.com[/email]
>
> "vrba" <hrvojev@recro.hr> wrote in message
> news:OCRbAodXDHA.1580@tk2msftngp13.phx.gbl...> value> > Hello and thank you, John.
> >
> > As alert box shows, nothing was put in JavaScript, i.e., the source says
> > onclick="return validacija('')", just as if the text box was empty (no> > for the parameter). Funny, but the same source shows correct value inthe> > text box parameters, e.g. <input name="dgProdukti:_ctl4:tbKolicina"
> > type="text" value="711" id="dgProdukti__ctl4_tbKolicina" />, 711 beingto> what> > entered number that doesn't reach the JavaScript....
> > Funny!
> >
> > Hrvoje
> >
> >
> > "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> > news:#L08TIbXDHA.2632@TK2MSFTNGP09.phx.gbl...> > > Hrvoje,
> > >
> > > Take a look at the generated HTML with View Source in IE. Look to see> within> > > was put into your JavaScript.
> > > -- .e.
> > > John Saunders
> > > Internet Engineer
> > > [email]john.saunders@surfcontrol.com[/email]
> > >
> > > "Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
> > > news:uNYA4waXDHA.1384@TK2MSFTNGP10.phx.gbl...
> > > > Vidar,
> > > >
> > > > thank you for the advice.
> > > > Unfortunately, it still doesn't work - it displays error message> > > the
> > > > alert box: "'this.form.tbKolicina.value' is null or not an
> > > > object"....somehow it doesn't recognize it.
> > > >
> > > > Hrvoje
> > > >
> > > >
> > > > "Vidar Petursson" <theking@icysoft.com> wrote in message
> > > > news:OYZX$oaXDHA.888@TK2MSFTNGP10.phx.gbl...
> > > > > Hi
> > > > >
> > > > > This should pass the value of tbKolicina field to the function
> > > > > imgbtKosarica.Attributes.Add("onclick", "return
> > > > > validacija(this.form.tbKolicina.value)")
> > > > >
> > > > > --
> > > > > Best Regards
> > > > > Vidar Petursson
> > > > > ==============================
> > > > > Microsoft Internet Client & Controls MVP
> > > > > ==============================
> > > > > "Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
> > > > > news:%23RYeHfaXDHA.1644@TK2MSFTNGP10.phx.gbl...
> > > > > > Hello,
> > > > > >
> > > > > > I have the following problem:
> > > > > > I have a DataGrid control on my page with a column with TextBox
> > > controls
> > > > > and
> > > > > > another one with ImageButton controls. In order to force a calladded> > > > > > JavaScript client-side script when ImageButton is pressed, Ito> > the> > shown> > > > > > following code to OnItemDataBoundEvent (check for Item Types not> > e.Item.Cells(6).FindControl("tbKolicina")> > > > > > here):
> > > > > >
> > > > > > Dim tbKolicina As TextBox => > > > > > Dim imgbtKosarica As ImageButton =
> > > > > > e.Item.Cells(7).FindControl("imgbtKosarica")
> > > > > > imgbtKosarica.Attributes.Add("onClick", "return validacija('" &
> > > > > > tbKolicina.Text & "')")
> > > > > >
> > > > > > "tbKolicina" is the TextBox control whose value I want to passclicked.> > > > > JavaScript
> > > > > > for validation when ImageButton called "imgbtKosarica" isto> > yet)> > > > > > JavaScript is currently just an elementary script (no validation> > > > and
> > > > > > should simply display an alert box with the passed parameter
> > > > > > (tbKolicinaText) displayed when the ImageButton is clicked.
> > > > > >
> > > > > > It works fine (finds the controls and calls the JavaScript) upan> the> > one> > > > > final
> > > > > > point: the value of the TextBox (tbKolicina.text) doesn't reach> > > > > > JavaScript script. Whatever I write into the TextBox, I receive>> >> > > empty
> > > > > > alert box. But, if I set the value for the tbKolicina.text
> > > > > programatically,
> > > > > > that value does get passed. I concluded therefore that only the
> > > initial
> > > > > > value reaches JavaScript.
> > > > > >
> > > > > > What did I do wrong and how could I make this validation work?
> > > > > >
> > > > > > Thank you in advance,
> > > > > > Hrvoje
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
Hrvoje Vrbanc Guest
-
John Saunders #8
Re: problems with client scripting invoked from DataGrid OnItemDataBoundEvent
"Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
news:%23FBgxLlXDHA.3268@tk2msftngp13.phx.gbl...Nope. In OnItemDataBound you're supposed to bind data to the controls in the> Hello John,
> hm, I thought that OnItemDataBound I just wire the script and that values
> could be transferred later.....obviously a mistake.
item if they don't do that on their own. For instance, I have an employee
list datagrid with a Delete LinkButton in it. I use ItemDataBound to set the
JavaScript which displays the confirm dialog, and I take the opportunity to
concatenate the first and last name of the employee being deleted. I have a
HyperLink control in the same grid, and I set the NavigateUrl in the
ItemDataBound event to include the employee ID in the query string of the
URL.
So, I use it for things which are too complicated for a databinding
expression to handle, or for things where the databinding expression is
simply too complicated or ugly to look at in the .aspx file. I move it into
the .aspx.cs file where nobody needs to see it!
--
John Saunders
Internet Engineer
[email]john.saunders@surfcontrol.com[/email]
John Saunders Guest
-
Hrvoje Vrbanc #9
Re: problems with client scripting invoked from DataGrid OnItemDataBoundEvent
I understand.
But what is the solution for my problems then (a rhetorical question :-))?
Hrvoje
"John Saunders" <john.saunders@surfcontrol.com> wrote in message
news:#xTE3slXDHA.388@TK2MSFTNGP10.phx.gbl...values> "Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
> news:%23FBgxLlXDHA.3268@tk2msftngp13.phx.gbl...> > Hello John,
> > hm, I thought that OnItemDataBound I just wire the script and thatthe>> > could be transferred later.....obviously a mistake.
> Nope. In OnItemDataBound you're supposed to bind data to the controls inthe> item if they don't do that on their own. For instance, I have an employee
> list datagrid with a Delete LinkButton in it. I use ItemDataBound to setto> JavaScript which displays the confirm dialog, and I take the opportunitya> concatenate the first and last name of the employee being deleted. I haveinto> HyperLink control in the same grid, and I set the NavigateUrl in the
> ItemDataBound event to include the employee ID in the query string of the
> URL.
>
> So, I use it for things which are too complicated for a databinding
> expression to handle, or for things where the databinding expression is
> simply too complicated or ugly to look at in the .aspx file. I move it> the .aspx.cs file where nobody needs to see it!
> --
> John Saunders
> Internet Engineer
> [email]john.saunders@surfcontrol.com[/email]
>
>
Hrvoje Vrbanc Guest



Reply With Quote

