Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Sorry for reposting - can not figure out...

Reply
Thread Tools

Sorry for reposting - can not figure out...

 
 
J Snaith
Guest
Posts: n/a
 
      04-05-2010
Very sorry for reposting same message. I cannot figure out this concern
issue....

Good day. I have asp.net page in vb.net that gets set of photos records
from a database table (paths to photos). Loads that data into session
datatable, divide into parts and display each part at timer interval. For
eg. every 7 seconds display first 5 (of 20) photos in asp.net datagrid, then
next set of 5, then next set of 5 photos, etcetera. When all 20 photos have
been displayed (paged) I want to show new panel for 7 seconds (pnlWarning).
Hide pnlViewPhotos and show pnlWarning. Then, start loop again and start
displaying paged photos again (in pnlViewPhotos). Then after 20 display
warning again, etcetera. I have the code working well to page photos but
cannot determine where to show pnlWarning panel and hide other panel for the
7 seconds after all photos displayed, then start displaying photos again
after 7 seconds of making pnlWarning visible=true. Could you please take
look at following code snippet and please advise where I may accomplish this
tasks? Any direction you have would be appreciate and of great help. Thank
you and have fantastic day.


'click button to start
Sub btnDisplayPagingPhotos_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim varPhotosID As String = 24
session("thePageSize") = 7
Timer1.Interval = 7 'seconds
GetPhotos(varPhotosID)
End Sub

Private Sub GetPhotos(ByVal photosid As String)
Dim ssql As String
Dim cnn As New SqlConnection(ConfigurationSettings.AppSettings.Ge t("cnn"))
cnn.Open()
ssql = "exec procGetPhotos '" & photosid & "'"

pnlViewPhotos.visible = True

session("da") = New SqlDataAdapter(ssql, cnn)
session("ds") = New DataSet
session("da").Fill(session("ds"), "photos")
session("dtPhotosSource") = session("ds").Tables("photos")

getPhotosData()

cnn.Close()
End Sub

Private Sub goToFirstSetOfPhotos()
If session("theCurrentPage") = 1 Then
Return
End If
session("theCurrentPage") = 1
session("theRecordNumber") = 0
LoadPhotos()
End Sub

Private Sub LoadPhotos()
Timer1.Interval = ddlPagingInterval.SelectedItem.Value
session("dtTemp") = session("dtPhotosSource").Clone
If session("theCurrentPage") = session("thePageCount") Then
session("endRec") = session("theMaxRecord")
Else
session("endRec") = session("thePageSize") * session("theCurrentPage")
End If
session("startRec") = session("theRecordNumber")

'if photos actually exist
Dim intCount As Integer
intCount = session("dtPhotosSource").Rows.Count
If intCount > 0 Then
Dim i As Integer
For i = session("startRec") To session("endRec") - 1
session("dtTemp").ImportRow(session("dtPhotosSourc e").Rows(i))
session("theRecordNumber") = session("theRecordNumber") + 1
Next
End If

dgPhotos.DataSource = session("dtTemp")
dgPhotos.Databind()
End Sub

Private Sub getPhotosData()
session("theMaxRecord") = session("dtPhotosSource").Rows.Count
session("thePageCount") = session("theMaxRecord") \ session("thePageSize")
If (session("theMaxRecord") Mod session("thePageSize")) > 0 Then
session("thePageCount") = session("thePageCount") + 1
End If
session("theCurrentPage") = 1
session("theRecordNumber") = 0
LoadPhotos()
End Sub

Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Elapsed
session("theCurrentPage") = session("theCurrentPage") + 1
If session("theCurrentPage") > session("thePageCount") Then
session("theCurrentPage") = session("thePageCount")
If session("theRecordNumber") = session("theMaxRecord") Then
session("theCurrentPage") = 1
getPhotosData()
goToFirstSetOfPhotos()
Dim varPhotosID As String = 24
GetPhotos(photosid)
Return
End If
End If
LoadPhotos()
End Sub



 
Reply With Quote
 
 
 
 
Family Tree Mike
Guest
Posts: n/a
 
      04-05-2010
On 4/4/2010 8:45 PM, J Snaith wrote:
> Very sorry for reposting same message. I cannot figure out this concern
> issue....
>
> Good day. I have asp.net page in vb.net that gets set of photos records
> from a database table (paths to photos). Loads that data into session
> datatable, divide into parts and display each part at timer interval. For
> eg. every 7 seconds display first 5 (of 20) photos in asp.net datagrid,
> then
> next set of 5, then next set of 5 photos, etcetera. When all 20 photos have
> been displayed (paged) I want to show new panel for 7 seconds (pnlWarning).
> Hide pnlViewPhotos and show pnlWarning. Then, start loop again and start
> displaying paged photos again (in pnlViewPhotos). Then after 20 display
> warning again, etcetera. I have the code working well to page photos but
> cannot determine where to show pnlWarning panel and hide other panel for
> the
> 7 seconds after all photos displayed, then start displaying photos again
> after 7 seconds of making pnlWarning visible=true. Could you please take
> look at following code snippet and please advise where I may accomplish
> this
> tasks? Any direction you have would be appreciate and of great help. Thank
> you and have fantastic day.
>
>

<Snip>
>
> Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Timer1.Elapsed
> session("theCurrentPage") = session("theCurrentPage") + 1
> If session("theCurrentPage") > session("thePageCount") Then
> session("theCurrentPage") = session("thePageCount")
> If session("theRecordNumber") = session("theMaxRecord") Then
> session("theCurrentPage") = 1
> getPhotosData()
> goToFirstSetOfPhotos()
> Dim varPhotosID As String = 24
> GetPhotos(photosid)
> Return
> End If
> End If
> LoadPhotos()
> End Sub
>
>
>


I saw your previous posts, but figured an ASP.Net person with experience
with the System.Web.UI.Timer control would be better. I have no
experience with that control.

Your timer handler checks if the current page is greater than the page
count, and resets it to the page count on true. Instead of this, set it
to zero. Later, check if the value is zero, and if so, set the
pnlWarning to true, and the pnlViewPhotos visible value to false. Make
sure on a value of One, to reverse the visibility.

--
Mike
 
Reply With Quote
 
 
 
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      04-05-2010
Be aware that there are many other possibilities

http://www.vb-tips.com/ServerClock.aspx

"J Snaith" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Very sorry for reposting same message. I cannot figure out this concern
> issue....
>
> Good day. I have asp.net page in vb.net that gets set of photos records
> from a database table (paths to photos). Loads that data into session
> datatable, divide into parts and display each part at timer interval. For
> eg. every 7 seconds display first 5 (of 20) photos in asp.net datagrid,
> then
> next set of 5, then next set of 5 photos, etcetera. When all 20 photos
> have
> been displayed (paged) I want to show new panel for 7 seconds
> (pnlWarning).
> Hide pnlViewPhotos and show pnlWarning. Then, start loop again and start
> displaying paged photos again (in pnlViewPhotos). Then after 20 display
> warning again, etcetera. I have the code working well to page photos but
> cannot determine where to show pnlWarning panel and hide other panel for
> the
> 7 seconds after all photos displayed, then start displaying photos again
> after 7 seconds of making pnlWarning visible=true. Could you please take
> look at following code snippet and please advise where I may accomplish
> this
> tasks? Any direction you have would be appreciate and of great help.
> Thank
> you and have fantastic day.
>
>
> 'click button to start
> Sub btnDisplayPagingPhotos_Click(ByVal sender As Object, ByVal e As
> System.EventArgs)
> Dim varPhotosID As String = 24
> session("thePageSize") = 7
> Timer1.Interval = 7 'seconds
> GetPhotos(varPhotosID)
> End Sub
>
> Private Sub GetPhotos(ByVal photosid As String)
> Dim ssql As String
> Dim cnn As New SqlConnection(ConfigurationSettings.AppSettings.Ge t("cnn"))
> cnn.Open()
> ssql = "exec procGetPhotos '" & photosid & "'"
>
> pnlViewPhotos.visible = True
>
> session("da") = New SqlDataAdapter(ssql, cnn)
> session("ds") = New DataSet
> session("da").Fill(session("ds"), "photos")
> session("dtPhotosSource") = session("ds").Tables("photos")
>
> getPhotosData()
>
> cnn.Close()
> End Sub
>
> Private Sub goToFirstSetOfPhotos()
> If session("theCurrentPage") = 1 Then
> Return
> End If
> session("theCurrentPage") = 1
> session("theRecordNumber") = 0
> LoadPhotos()
> End Sub
>
> Private Sub LoadPhotos()
> Timer1.Interval = ddlPagingInterval.SelectedItem.Value
> session("dtTemp") = session("dtPhotosSource").Clone
> If session("theCurrentPage") = session("thePageCount") Then
> session("endRec") = session("theMaxRecord")
> Else
> session("endRec") = session("thePageSize") * session("theCurrentPage")
> End If
> session("startRec") = session("theRecordNumber")
>
> 'if photos actually exist
> Dim intCount As Integer
> intCount = session("dtPhotosSource").Rows.Count
> If intCount > 0 Then
> Dim i As Integer
> For i = session("startRec") To session("endRec") - 1
> session("dtTemp").ImportRow(session("dtPhotosSourc e").Rows(i))
> session("theRecordNumber") = session("theRecordNumber") + 1
> Next
> End If
>
> dgPhotos.DataSource = session("dtTemp")
> dgPhotos.Databind()
> End Sub
>
> Private Sub getPhotosData()
> session("theMaxRecord") = session("dtPhotosSource").Rows.Count
> session("thePageCount") = session("theMaxRecord") \ session("thePageSize")
> If (session("theMaxRecord") Mod session("thePageSize")) > 0 Then
> session("thePageCount") = session("thePageCount") + 1
> End If
> session("theCurrentPage") = 1
> session("theRecordNumber") = 0
> LoadPhotos()
> End Sub
>
> Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Timer1.Elapsed
> session("theCurrentPage") = session("theCurrentPage") + 1
> If session("theCurrentPage") > session("thePageCount") Then
> session("theCurrentPage") = session("thePageCount")
> If session("theRecordNumber") = session("theMaxRecord") Then
> session("theCurrentPage") = 1
> getPhotosData()
> goToFirstSetOfPhotos()
> Dim varPhotosID As String = 24
> GetPhotos(photosid)
> Return
> End If
> End If
> LoadPhotos()
> End Sub
>
>
>

 
Reply With Quote
 
J Snaith
Guest
Posts: n/a
 
      04-05-2010
Thank you much for the reply. I have been trying many things but cannot get
it working. I will continue with your suggestions and see if I can get it
to work. Thank you.


"Family Tree Mike" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On 4/4/2010 8:45 PM, J Snaith wrote:
>> Very sorry for reposting same message. I cannot figure out this concern
>> issue....
>>
>> Good day. I have asp.net page in vb.net that gets set of photos records
>> from a database table (paths to photos). Loads that data into session
>> datatable, divide into parts and display each part at timer interval. For
>> eg. every 7 seconds display first 5 (of 20) photos in asp.net datagrid,
>> then
>> next set of 5, then next set of 5 photos, etcetera. When all 20 photos
>> have
>> been displayed (paged) I want to show new panel for 7 seconds
>> (pnlWarning).
>> Hide pnlViewPhotos and show pnlWarning. Then, start loop again and start
>> displaying paged photos again (in pnlViewPhotos). Then after 20 display
>> warning again, etcetera. I have the code working well to page photos but
>> cannot determine where to show pnlWarning panel and hide other panel for
>> the
>> 7 seconds after all photos displayed, then start displaying photos again
>> after 7 seconds of making pnlWarning visible=true. Could you please take
>> look at following code snippet and please advise where I may accomplish
>> this
>> tasks? Any direction you have would be appreciate and of great help.
>> Thank
>> you and have fantastic day.
>>
>>

> <Snip>
> >
>> Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As
>> System.EventArgs) Handles Timer1.Elapsed
>> session("theCurrentPage") = session("theCurrentPage") + 1
>> If session("theCurrentPage") > session("thePageCount") Then
>> session("theCurrentPage") = session("thePageCount")
>> If session("theRecordNumber") = session("theMaxRecord") Then
>> session("theCurrentPage") = 1
>> getPhotosData()
>> goToFirstSetOfPhotos()
>> Dim varPhotosID As String = 24
>> GetPhotos(photosid)
>> Return
>> End If
>> End If
>> LoadPhotos()
>> End Sub
>>
>>
>>

>
> I saw your previous posts, but figured an ASP.Net person with experience
> with the System.Web.UI.Timer control would be better. I have no
> experience with that control.
>
> Your timer handler checks if the current page is greater than the page
> count, and resets it to the page count on true. Instead of this, set it
> to zero. Later, check if the value is zero, and if so, set the pnlWarning
> to true, and the pnlViewPhotos visible value to false. Make sure on a
> value of One, to reverse the visibility.
>
> --
> Mike


 
Reply With Quote
 
J Snaith
Guest
Posts: n/a
 
      04-05-2010
Thank you Cor for the link.

"Cor Ligthert[MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Be aware that there are many other possibilities
>
> http://www.vb-tips.com/ServerClock.aspx
>
> "J Snaith" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Very sorry for reposting same message. I cannot figure out this concern
>> issue....
>>
>> Good day. I have asp.net page in vb.net that gets set of photos records
>> from a database table (paths to photos). Loads that data into session
>> datatable, divide into parts and display each part at timer interval.
>> For
>> eg. every 7 seconds display first 5 (of 20) photos in asp.net datagrid,
>> then
>> next set of 5, then next set of 5 photos, etcetera. When all 20 photos
>> have
>> been displayed (paged) I want to show new panel for 7 seconds
>> (pnlWarning).
>> Hide pnlViewPhotos and show pnlWarning. Then, start loop again and start
>> displaying paged photos again (in pnlViewPhotos). Then after 20 display
>> warning again, etcetera. I have the code working well to page photos but
>> cannot determine where to show pnlWarning panel and hide other panel for
>> the
>> 7 seconds after all photos displayed, then start displaying photos again
>> after 7 seconds of making pnlWarning visible=true. Could you please take
>> look at following code snippet and please advise where I may accomplish
>> this
>> tasks? Any direction you have would be appreciate and of great help.
>> Thank
>> you and have fantastic day.
>>
>>
>> 'click button to start
>> Sub btnDisplayPagingPhotos_Click(ByVal sender As Object, ByVal e As
>> System.EventArgs)
>> Dim varPhotosID As String = 24
>> session("thePageSize") = 7
>> Timer1.Interval = 7 'seconds
>> GetPhotos(varPhotosID)
>> End Sub
>>
>> Private Sub GetPhotos(ByVal photosid As String)
>> Dim ssql As String
>> Dim cnn As New
>> SqlConnection(ConfigurationSettings.AppSettings.Ge t("cnn"))
>> cnn.Open()
>> ssql = "exec procGetPhotos '" & photosid & "'"
>>
>> pnlViewPhotos.visible = True
>>
>> session("da") = New SqlDataAdapter(ssql, cnn)
>> session("ds") = New DataSet
>> session("da").Fill(session("ds"), "photos")
>> session("dtPhotosSource") = session("ds").Tables("photos")
>>
>> getPhotosData()
>>
>> cnn.Close()
>> End Sub
>>
>> Private Sub goToFirstSetOfPhotos()
>> If session("theCurrentPage") = 1 Then
>> Return
>> End If
>> session("theCurrentPage") = 1
>> session("theRecordNumber") = 0
>> LoadPhotos()
>> End Sub
>>
>> Private Sub LoadPhotos()
>> Timer1.Interval = ddlPagingInterval.SelectedItem.Value
>> session("dtTemp") = session("dtPhotosSource").Clone
>> If session("theCurrentPage") = session("thePageCount") Then
>> session("endRec") = session("theMaxRecord")
>> Else
>> session("endRec") = session("thePageSize") * session("theCurrentPage")
>> End If
>> session("startRec") = session("theRecordNumber")
>>
>> 'if photos actually exist
>> Dim intCount As Integer
>> intCount = session("dtPhotosSource").Rows.Count
>> If intCount > 0 Then
>> Dim i As Integer
>> For i = session("startRec") To session("endRec") - 1
>> session("dtTemp").ImportRow(session("dtPhotosSourc e").Rows(i))
>> session("theRecordNumber") = session("theRecordNumber") + 1
>> Next
>> End If
>>
>> dgPhotos.DataSource = session("dtTemp")
>> dgPhotos.Databind()
>> End Sub
>>
>> Private Sub getPhotosData()
>> session("theMaxRecord") = session("dtPhotosSource").Rows.Count
>> session("thePageCount") = session("theMaxRecord") \
>> session("thePageSize")
>> If (session("theMaxRecord") Mod session("thePageSize")) > 0 Then
>> session("thePageCount") = session("thePageCount") + 1
>> End If
>> session("theCurrentPage") = 1
>> session("theRecordNumber") = 0
>> LoadPhotos()
>> End Sub
>>
>> Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As
>> System.EventArgs) Handles Timer1.Elapsed
>> session("theCurrentPage") = session("theCurrentPage") + 1
>> If session("theCurrentPage") > session("thePageCount") Then
>> session("theCurrentPage") = session("thePageCount")
>> If session("theRecordNumber") = session("theMaxRecord") Then
>> session("theCurrentPage") = 1
>> getPhotosData()
>> goToFirstSetOfPhotos()
>> Dim varPhotosID As String = 24
>> GetPhotos(photosid)
>> Return
>> End If
>> End If
>> LoadPhotos()
>> End Sub
>>
>>
>>

 
Reply With Quote
 
J Snaith
Guest
Posts: n/a
 
      04-05-2010
Hi Mike. Well I've tried many different things in the timer interval to
accomplish this task, however, something is not working. Both panels
display at same time and don't disappear. I don't think I'm familiar enough
with timer to complete this. Do you have any further advice on how this
task can be accomplished? Appreciate any feedback and guidance, thank you
kindly.


"Family Tree Mike" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On 4/4/2010 8:45 PM, J Snaith wrote:
>> Very sorry for reposting same message. I cannot figure out this concern
>> issue....
>>
>> Good day. I have asp.net page in vb.net that gets set of photos records
>> from a database table (paths to photos). Loads that data into session
>> datatable, divide into parts and display each part at timer interval. For
>> eg. every 7 seconds display first 5 (of 20) photos in asp.net datagrid,
>> then
>> next set of 5, then next set of 5 photos, etcetera. When all 20 photos
>> have
>> been displayed (paged) I want to show new panel for 7 seconds
>> (pnlWarning).
>> Hide pnlViewPhotos and show pnlWarning. Then, start loop again and start
>> displaying paged photos again (in pnlViewPhotos). Then after 20 display
>> warning again, etcetera. I have the code working well to page photos but
>> cannot determine where to show pnlWarning panel and hide other panel for
>> the
>> 7 seconds after all photos displayed, then start displaying photos again
>> after 7 seconds of making pnlWarning visible=true. Could you please take
>> look at following code snippet and please advise where I may accomplish
>> this
>> tasks? Any direction you have would be appreciate and of great help.
>> Thank
>> you and have fantastic day.
>>
>>

> <Snip>
> >
>> Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As
>> System.EventArgs) Handles Timer1.Elapsed
>> session("theCurrentPage") = session("theCurrentPage") + 1
>> If session("theCurrentPage") > session("thePageCount") Then
>> session("theCurrentPage") = session("thePageCount")
>> If session("theRecordNumber") = session("theMaxRecord") Then
>> session("theCurrentPage") = 1
>> getPhotosData()
>> goToFirstSetOfPhotos()
>> Dim varPhotosID As String = 24
>> GetPhotos(photosid)
>> Return
>> End If
>> End If
>> LoadPhotos()
>> End Sub
>>
>>
>>

>
> I saw your previous posts, but figured an ASP.Net person with experience
> with the System.Web.UI.Timer control would be better. I have no
> experience with that control.
>
> Your timer handler checks if the current page is greater than the page
> count, and resets it to the page count on true. Instead of this, set it
> to zero. Later, check if the value is zero, and if so, set the pnlWarning
> to true, and the pnlViewPhotos visible value to false. Make sure on a
> value of One, to reverse the visibility.
>
> --
> Mike


 
Reply With Quote
 
Family Tree Mike
Guest
Posts: n/a
 
      04-05-2010
On 4/5/2010 8:28 AM, J Snaith wrote:
> Hi Mike. Well I've tried many different things in the timer interval to
> accomplish this task, however, something is not working. Both panels
> display at same time and don't disappear. I don't think I'm familiar
> enough with timer to complete this. Do you have any further advice on
> how this task can be accomplished? Appreciate any feedback and guidance,
> thank you kindly.
>
>
>


Again, I've never used this timer control, but from reading
http://msdn.microsoft.com/en-us/libr....ui.timer.aspx, it
looks like I would put my two panels that need to be toggled for
visibility into a containing UpdatePanel. Something like this:

<asp:UpdatePanel ID="UpdPnl" runat="server">
<aspanel ID="pnlViewPhotos" runat="server"/>
<aspanel ID="pnlWarning" runat="server" visible="false"/>
</asp:UpdatePanel>



--
Mike
 
Reply With Quote
 
J Snaith
Guest
Posts: n/a
 
      04-06-2010
Thanks Mike. Appreciate the comments and link. Read the contents nut am
still now sure how to apply this to my case. I've been trying and trying
but cannot get my stuff to work as I want. There must be a way that I am
missing.

"Family Tree Mike" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On 4/5/2010 8:28 AM, J Snaith wrote:
>> Hi Mike. Well I've tried many different things in the timer interval to
>> accomplish this task, however, something is not working. Both panels
>> display at same time and don't disappear. I don't think I'm familiar
>> enough with timer to complete this. Do you have any further advice on
>> how this task can be accomplished? Appreciate any feedback and guidance,
>> thank you kindly.
>>
>>
>>

>
> Again, I've never used this timer control, but from reading
> http://msdn.microsoft.com/en-us/libr....ui.timer.aspx, it looks
> like I would put my two panels that need to be toggled for visibility into
> a containing UpdatePanel. Something like this:
>
> <asp:UpdatePanel ID="UpdPnl" runat="server">
> <aspanel ID="pnlViewPhotos" runat="server"/>
> <aspanel ID="pnlWarning" runat="server" visible="false"/>
> </asp:UpdatePanel>
>
>
>
> --
> Mike


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorry for crosspost - cant figure out timer issue... J Snaith ASP .Net Web Controls 0 04-05-2010 02:48 PM
reposting 70-290 not sure about mspress harryph MCSA 3 04-30-2004 03:49 PM
sorry for reposting sean MCSE 5 03-03-2004 08:26 PM
Sorry Sorry Sorry but what camera for me - Real Esate Phil Digital Photography 19 12-28-2003 05:28 PM
Reposting--which one is better? nomi MCSD 1 07-17-2003 12:27 PM



Advertisments