Thursday, March 29, 2012
Set DataList SelectedIndex - 2nd Post
This is a fairly simple request...I am looking for some help...
I want to set the SelectedIndex of a DataList control to equal a specific
record in the database. What is the easiest way to accomplish this??
Thanks,
David D. McCroryDavid D. McCrory wrote:
> This is the second post for this question...please help!!
> This is a fairly simple request...I am looking for some help...
> I want to set the SelectedIndex of a DataList control to equal a specific
> record in the database. What is the easiest way to accomplish this??
>
> Thanks,
> David D. McCrory
I would add a handler for the ItemDataBound event of the DataList and
then the event args give you access to the current item and its data.
e.Item.DataItem gives the current item in the datasource; use this to
check for a certain value
e.Item.ItemIndex gives the current item's index
I believe you can set the selectedindex in this event; if not, set a
local/member var to the value and then after the DataBind, set it.
The other solution is to loop the items after the DataBind instead of
using the event, but doing the first way does one less loop.
--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Thanks Craig...I will give it a try.....
"Craig Deelsnyder" <cdeelsny@.NO_SPAM_4_MEyahoo.com> wrote in message
news:OO0DxWv3DHA.2528@.tk2msftngp13.phx.gbl...
> David D. McCrory wrote:
> > This is the second post for this question...please help!!
> > This is a fairly simple request...I am looking for some help...
> > I want to set the SelectedIndex of a DataList control to equal a
specific
> > record in the database. What is the easiest way to accomplish this??
> > Thanks,
> > David D. McCrory
> I would add a handler for the ItemDataBound event of the DataList and
> then the event args give you access to the current item and its data.
> e.Item.DataItem gives the current item in the datasource; use this to
> check for a certain value
> e.Item.ItemIndex gives the current item's index
> I believe you can set the selectedindex in this event; if not, set a
> local/member var to the value and then after the DataBind, set it.
> The other solution is to loop the items after the DataBind instead of
> using the event, but doing the first way does one less loop.
> --
> Craig Deelsnyder
> Microsoft MVP - ASP/ASP.NET
Tuesday, March 13, 2012
Set Nothing
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: BC30807: 'Let' and 'Set' assignment statements are
no longer supported.
Source Error:
Line 39: If TextBox_Account.Text <> String.Empty Then
Line 40:
Line 41: Set myDataGrid = nothing
Line 42:
Line 43: Dim okcon As New
SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
How to set object to nothing?as the message says. remove the set
myDataGrid = nothing
-- bruce (sqlwork.com)
"Sam" <cybersam88@.hotmail.com> wrote in message
news:%23EfKzJEJFHA.1528@.TK2MSFTNGP09.phx.gbl...
| Compilation Error
| Description: An error occurred during the compilation of a resource
required
| to service this request. Please review the following specific error
details
| and modify your source code appropriately.
|
| Compiler Error Message: BC30807: 'Let' and 'Set' assignment statements are
| no longer supported.
|
| Source Error:
|
|
| Line 39: If TextBox_Account.Text <> String.Empty Then
| Line 40:
| Line 41: Set myDataGrid = nothing
| Line 42:
| Line 43: Dim okcon As New
| SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
|
|
| How to set object to nothing?
|
|
Hi Sam,
Go through the error..
It says what the problem is 'Let' and 'Set' assignment statements are no
longer supported.!!!
U are compiling VBscript using .Net framework!!
What are you trying to do!!!
Patrick
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!
Simply remove the word "Set" to get rid of the error.
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Sam" <cybersam88@.hotmail.com> wrote in message
news:%23EfKzJEJFHA.1528@.TK2MSFTNGP09.phx.gbl...
> Compilation Error
> Description: An error occurred during the compilation of a resource
> required to service this request. Please review the following specific
> error details and modify your source code appropriately.
> Compiler Error Message: BC30807: 'Let' and 'Set' assignment statements are
> no longer supported.
> Source Error:
>
> Line 39: If TextBox_Account.Text <> String.Empty Then
> Line 40:
> Line 41: Set myDataGrid = nothing
> Line 42:
> Line 43: Dim okcon As New
> SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
>
> How to set object to nothing?
>
My, aren't we excitable.
"Patrick Olurotimi Ige" <ige@.iprimus.com.au> wrote in message
news:uktjpZEJFHA.2132@.TK2MSFTNGP14.phx.gbl...
> Hi Sam,
> Go through the error..
> It says what the problem is 'Let' and 'Set' assignment statements are no
> longer supported.!!!
> U are compiling VBscript using .Net framework!!
> What are you trying to do!!!
> Patrick
Yes we are Ken:)
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!
Set Nothing
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: BC30807: 'Let' and 'Set' assignment statements are
no longer supported.
Source Error:
Line 39: If TextBox_Account.Text <> String.Empty Then
Line 40:
Line 41: Set myDataGrid = nothing
Line 42:
Line 43: Dim okcon As New
SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
How to set object to nothing?as the message says. remove the set
myDataGrid = nothing
-- bruce (sqlwork.com)
"Sam" <cybersam88@.hotmail.com> wrote in message
news:%23EfKzJEJFHA.1528@.TK2MSFTNGP09.phx.gbl...
| Compilation Error
| Description: An error occurred during the compilation of a resource
required
| to service this request. Please review the following specific error
details
| and modify your source code appropriately.
|
| Compiler Error Message: BC30807: 'Let' and 'Set' assignment statements are
| no longer supported.
|
| Source Error:
|
|
| Line 39: If TextBox_Account.Text <> String.Empty Then
| Line 40:
| Line 41: Set myDataGrid = nothing
| Line 42:
| Line 43: Dim okcon As New
| SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
|
|
| How to set object to nothing?
|
|
Hi Sam,
Go through the error..
It says what the problem is 'Let' and 'Set' assignment statements are no
longer supported.!!!
U are compiling VBscript using .Net framework!!
What are you trying to do!!!
Patrick
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Simply remove the word "Set" to get rid of the error.
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Sam" <cybersam88@.hotmail.com> wrote in message
news:%23EfKzJEJFHA.1528@.TK2MSFTNGP09.phx.gbl...
> Compilation Error
> Description: An error occurred during the compilation of a resource
> required to service this request. Please review the following specific
> error details and modify your source code appropriately.
> Compiler Error Message: BC30807: 'Let' and 'Set' assignment statements are
> no longer supported.
> Source Error:
>
> Line 39: If TextBox_Account.Text <> String.Empty Then
> Line 40:
> Line 41: Set myDataGrid = nothing
> Line 42:
> Line 43: Dim okcon As New
> SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
>
> How to set object to nothing?
My, aren't we excitable.
"Patrick Olurotimi Ige" <ige@.iprimus.com.au> wrote in message
news:uktjpZEJFHA.2132@.TK2MSFTNGP14.phx.gbl...
> Hi Sam,
> Go through the error..
> It says what the problem is 'Let' and 'Set' assignment statements are no
> longer supported.!!!
> U are compiling VBscript using .Net framework!!
> What are you trying to do!!!
> Patrick
Yes we are Ken:)
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!