473,406 Members | 2,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Getting data out of a datasource

I am using a datalist control (dlist_myfavorites) and this control is bound
to a sqldatareader source. Datalist is basicly populated by the following sp.

CREATE PROCEDURE [select_favorites_bymguid]

(
@mguid as nvarchar(50) -- member guid id
)

AS

SELECT
cat.acname 'category',
adds.aid 'refno',
adds.miname 'image',
adds.teaseline1 'tl1',
adds.teaseline2 'tl2',
adds.teaseline3 'tl3',
adds.displayguid 'displayguid',
fav.entrydate 'entrydate',
adds.aguid 'aguid'
FROM tbl_adds_whole adds join tbl_member_favorites fav
ON(fav.aguid= adds.aguid) join tbl_add_categories cat
ON(adds.category=cat.acid)
WHERE fav.mguid = @mguid and cat.aclanguage =1
I have a hidden label inside the datalist that hold "aguid" data as below:
<asp:label id="aguid" visible=false runat=server><%#
databinder.eval(container.dataitem, "aguid") %></asp:label>

I am using a check box control with "delete" id in my datalist control, in
order to find out which items will be deleted. Once the user clicks on a
"btn_delete_selected" button process the following code:

Private Sub btn_delete_selected_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btn_delete_selected.Click

Dim isdeleted As Boolean

Dim anitem As DataListItem

Dim mguid As String = context.User.Identity.Name

Dim aguid As String

Dim mymf As memberfunctions = New memberfunctions

For Each anitem In dlist_myfavorites.Items

isdeleted = CType(anitem.FindControl("delete"), CheckBox).Checked

If isdeleted Then

aguid = CType(anitem.FindControl("aguid"), Label).Text

mymf.delete_tbl_member_favorites(aguid, mguid)

End If

Next

End Sub

The problem is aguid in the above sub always returns "" value eventhough I
have some rows selected on the page. On the other hand isdeleted variable
always returns right values either true or false. What am I doing wrong here?
Thank you in advance.
Nov 19 '05 #1
4 1202
Kc
I believe the problem is that you cannot get the values after postback of a
hidden element.

Try making the checkbox visible and see if you still have the same
problem....if you don't, then you need to come up with a different way to
hold the variable.

Good luck.

KC

"regaliel" <re******@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
I am using a datalist control (dlist_myfavorites) and this control is bound to a sqldatareader source. Datalist is basicly populated by the following sp.
CREATE PROCEDURE [select_favorites_bymguid]

(
@mguid as nvarchar(50) -- member guid id
)

AS

SELECT
cat.acname 'category',
adds.aid 'refno',
adds.miname 'image',
adds.teaseline1 'tl1',
adds.teaseline2 'tl2',
adds.teaseline3 'tl3',
adds.displayguid 'displayguid',
fav.entrydate 'entrydate',
adds.aguid 'aguid'
FROM tbl_adds_whole adds join tbl_member_favorites fav
ON(fav.aguid= adds.aguid) join tbl_add_categories cat
ON(adds.category=cat.acid)
WHERE fav.mguid = @mguid and cat.aclanguage =1
I have a hidden label inside the datalist that hold "aguid" data as below:
<asp:label id="aguid" visible=false runat=server><%#
databinder.eval(container.dataitem, "aguid") %></asp:label>

I am using a check box control with "delete" id in my datalist control, in
order to find out which items will be deleted. Once the user clicks on a
"btn_delete_selected" button process the following code:

Private Sub btn_delete_selected_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btn_delete_selected.Click

Dim isdeleted As Boolean

Dim anitem As DataListItem

Dim mguid As String = context.User.Identity.Name

Dim aguid As String

Dim mymf As memberfunctions = New memberfunctions

For Each anitem In dlist_myfavorites.Items

isdeleted = CType(anitem.FindControl("delete"), CheckBox).Checked

If isdeleted Then

aguid = CType(anitem.FindControl("aguid"), Label).Text

mymf.delete_tbl_member_favorites(aguid, mguid)

End If

Next

End Sub

The problem is aguid in the above sub always returns "" value eventhough I
have some rows selected on the page. On the other hand isdeleted variable
always returns right values either true or false. What am I doing wrong here? Thank you in advance.

Nov 19 '05 #2
I did try to make the label that holds the aguid information visible and I
can see it on the page. However, it wont get it on the code when it is
processed. Any idea to get the value or another way to do it?

"Kc" wrote:
I believe the problem is that you cannot get the values after postback of a
hidden element.

Try making the checkbox visible and see if you still have the same
problem....if you don't, then you need to come up with a different way to
hold the variable.

Good luck.

KC

"regaliel" <re******@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
I am using a datalist control (dlist_myfavorites) and this control is

bound
to a sqldatareader source. Datalist is basicly populated by the following

sp.

CREATE PROCEDURE [select_favorites_bymguid]

(
@mguid as nvarchar(50) -- member guid id
)

AS

SELECT
cat.acname 'category',
adds.aid 'refno',
adds.miname 'image',
adds.teaseline1 'tl1',
adds.teaseline2 'tl2',
adds.teaseline3 'tl3',
adds.displayguid 'displayguid',
fav.entrydate 'entrydate',
adds.aguid 'aguid'
FROM tbl_adds_whole adds join tbl_member_favorites fav
ON(fav.aguid= adds.aguid) join tbl_add_categories cat
ON(adds.category=cat.acid)
WHERE fav.mguid = @mguid and cat.aclanguage =1
I have a hidden label inside the datalist that hold "aguid" data as below:
<asp:label id="aguid" visible=false runat=server><%#
databinder.eval(container.dataitem, "aguid") %></asp:label>

I am using a check box control with "delete" id in my datalist control, in
order to find out which items will be deleted. Once the user clicks on a
"btn_delete_selected" button process the following code:

Private Sub btn_delete_selected_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btn_delete_selected.Click

Dim isdeleted As Boolean

Dim anitem As DataListItem

Dim mguid As String = context.User.Identity.Name

Dim aguid As String

Dim mymf As memberfunctions = New memberfunctions

For Each anitem In dlist_myfavorites.Items

isdeleted = CType(anitem.FindControl("delete"), CheckBox).Checked

If isdeleted Then

aguid = CType(anitem.FindControl("aguid"), Label).Text

mymf.delete_tbl_member_favorites(aguid, mguid)

End If

Next

End Sub

The problem is aguid in the above sub always returns "" value eventhough I
have some rows selected on the page. On the other hand isdeleted variable
always returns right values either true or false. What am I doing wrong

here?
Thank you in advance.


Nov 19 '05 #3
Kc
Have you tried using the CommandArgument field? If you do this, then after
you do the CType and get the checkbox, you will then have your ID without
having to get an additional field.

If you need an example of this let me know.

KC
"regaliel" <re******@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.com...
I did try to make the label that holds the aguid information visible and I
can see it on the page. However, it wont get it on the code when it is
processed. Any idea to get the value or another way to do it?

"Kc" wrote:
I believe the problem is that you cannot get the values after postback of a hidden element.

Try making the checkbox visible and see if you still have the same
problem....if you don't, then you need to come up with a different way to hold the variable.

Good luck.

KC

"regaliel" <re******@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
I am using a datalist control (dlist_myfavorites) and this control is

bound
to a sqldatareader source. Datalist is basicly populated by the following
sp.

CREATE PROCEDURE [select_favorites_bymguid]

(
@mguid as nvarchar(50) -- member guid id
)

AS

SELECT
cat.acname 'category',
adds.aid 'refno',
adds.miname 'image',
adds.teaseline1 'tl1',
adds.teaseline2 'tl2',
adds.teaseline3 'tl3',
adds.displayguid 'displayguid',
fav.entrydate 'entrydate',
adds.aguid 'aguid'
FROM tbl_adds_whole adds join tbl_member_favorites fav
ON(fav.aguid= adds.aguid) join tbl_add_categories cat
ON(adds.category=cat.acid)
WHERE fav.mguid = @mguid and cat.aclanguage =1
I have a hidden label inside the datalist that hold "aguid" data as
below: <asp:label id="aguid" visible=false runat=server><%#
databinder.eval(container.dataitem, "aguid") %></asp:label>

I am using a check box control with "delete" id in my datalist control, in order to find out which items will be deleted. Once the user clicks on a "btn_delete_selected" button process the following code:

Private Sub btn_delete_selected_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_delete_selected.Click

Dim isdeleted As Boolean

Dim anitem As DataListItem

Dim mguid As String = context.User.Identity.Name

Dim aguid As String

Dim mymf As memberfunctions = New memberfunctions

For Each anitem In dlist_myfavorites.Items

isdeleted = CType(anitem.FindControl("delete"), CheckBox).Checked

If isdeleted Then

aguid = CType(anitem.FindControl("aguid"), Label).Text

mymf.delete_tbl_member_favorites(aguid, mguid)

End If

Next

End Sub

The problem is aguid in the above sub always returns "" value eventhough I have some rows selected on the page. On the other hand isdeleted variable always returns right values either true or false. What am I doing

wrong here?
Thank you in advance.


Nov 19 '05 #4
I have solved the problem by changing label control as follow:

<asp:label id="aguid" visible=false runat=server text="<%#
databinder.eval(container.dataitem, "aguid") %>"></asp:label>

Not its working properly. Thank you for your helps Kc.

"Kc" wrote:
Have you tried using the CommandArgument field? If you do this, then after
you do the CType and get the checkbox, you will then have your ID without
having to get an additional field.

If you need an example of this let me know.

KC
"regaliel" <re******@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.com...
I did try to make the label that holds the aguid information visible and I
can see it on the page. However, it wont get it on the code when it is
processed. Any idea to get the value or another way to do it?

"Kc" wrote:
I believe the problem is that you cannot get the values after postback of a hidden element.

Try making the checkbox visible and see if you still have the same
problem....if you don't, then you need to come up with a different way to hold the variable.

Good luck.

KC

"regaliel" <re******@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
> I am using a datalist control (dlist_myfavorites) and this control is
bound
> to a sqldatareader source. Datalist is basicly populated by the following sp.
>
> CREATE PROCEDURE [select_favorites_bymguid]
>
> (
> @mguid as nvarchar(50) -- member guid id
> )
>
> AS
>
> SELECT
> cat.acname 'category',
> adds.aid 'refno',
> adds.miname 'image',
> adds.teaseline1 'tl1',
> adds.teaseline2 'tl2',
> adds.teaseline3 'tl3',
> adds.displayguid 'displayguid',
> fav.entrydate 'entrydate',
> adds.aguid 'aguid'
>
>
> FROM tbl_adds_whole adds join tbl_member_favorites fav
> ON(fav.aguid= adds.aguid) join tbl_add_categories cat
> ON(adds.category=cat.acid)
> WHERE fav.mguid = @mguid and cat.aclanguage =1
>
>
> I have a hidden label inside the datalist that hold "aguid" data as below: > <asp:label id="aguid" visible=false runat=server><%#
> databinder.eval(container.dataitem, "aguid") %></asp:label>
>
> I am using a check box control with "delete" id in my datalist control, in > order to find out which items will be deleted. Once the user clicks on a > "btn_delete_selected" button process the following code:
>
> Private Sub btn_delete_selected_Click(ByVal sender As Object, ByVal e As > System.EventArgs) Handles btn_delete_selected.Click
>
> Dim isdeleted As Boolean
>
> Dim anitem As DataListItem
>
> Dim mguid As String = context.User.Identity.Name
>
> Dim aguid As String
>
> Dim mymf As memberfunctions = New memberfunctions
>
> For Each anitem In dlist_myfavorites.Items
>
> isdeleted = CType(anitem.FindControl("delete"), CheckBox).Checked
>
> If isdeleted Then
>
> aguid = CType(anitem.FindControl("aguid"), Label).Text
>
> mymf.delete_tbl_member_favorites(aguid, mguid)
>
> End If
>
> Next
>
> End Sub
>
> The problem is aguid in the above sub always returns "" value eventhough I > have some rows selected on the page. On the other hand isdeleted variable > always returns right values either true or false. What am I doing wrong here?
> Thank you in advance.
>
>


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: SenseForAll | last post by:
First please note I am a novice at VBA and not even that experienced with DAO/ADO and MS-SQL. Any assistance is appreciated. That said... I have an application written in Access w/ VBA. I need to...
1
by: Sławek Mróz | last post by:
Hi! Is it possible to get data just from DataGrid, not binded to any of DataSource? I can't find any suitable properties, every single example is based on binding data:-( I just want to put...
0
by: Fraggle | last post by:
I am using PlaceHolders in a Repeater to generate a multi choice survey. I need a way of testing to see what the placeholder has been turned into at runtime, and reading out the data. The admin...
4
by: What-a-Tool | last post by:
I am trying to write a program that will take all the members of a data base, add them to a tree, with all child relations as sub-nodes. I am having a problem getting the parent child relations...
4
by: Mike | last post by:
Hi, How can I get data frrom a datagrid. eg. if I have a datagrid of 2 columns and 2 rows, how can I get the data from it into array or variables!!!? Thanks -- Regads, Rochdi
9
by: nickyeng | last post by:
Hi My case is i get the error on runtime while getting data from a file. i get this error: Record of 12344 is found! 5 testing 4272 _cygtls::handle_exceptions: Error while dumping...
4
by: dfent | last post by:
I'm using MS Access 2003 1 form with 7 sub forms, updating 7 tables. I've split my database but still getting data changes error messages when multiple people are in the database. Any help would be...
6
by: bushwacker | last post by:
Hello all, I'm a chemical engineering student. our teacher has given us a project to do some calculations based on some equations. those equations include constants, which are to be read from a...
5
by: abhi3211 | last post by:
i am using java inside java script page. in that page i want to use two dropdown list. in first dropdown list i am getting data from ms-access database. in second dropdown list i want to get data...
0
by: uosef64 | last post by:
hi every one i want to give data from database and bound to a grid from a thread i write this sample code: ************************************** private void thr() { ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.