Opening a Popup windows and refreshing data

  • Thread starter Jennyfer J Barco
  • Start date
J

Jennyfer J Barco

Hello I have a datagrid and a linkbuttom in the datagrid that says Picture,
every time I click on the link "Picture" my program opens a popup window
showing a picture of the item the selected and information about the item.
On the html of the datagrid I have the following:
OnItemCommand="Grid_CartCommand" OnItemCreated="DataGrid_ItemCreated".

My VB functions are the following:
Sub DataGrid_ItemCreated(ByVal Sender As Object, ByVal e As
DataGridItemEventArgs)

Select Case e.Item.ItemType

Case ListItemType.Item, ListItemType.AlternatingItem

Dim myDeleteButton As LinkButton

myDeleteButton = e.Item.FindControl("PictureButton")

myDeleteButton.Attributes.Add("onclick",
"window.open('popup.aspx',null,'height=350, width=300,status= no, resizable=
no,scrollbars=no, toolbar=no,location=no,menubar=no ');")

End Select

Exit Sub



Sub Grid_CartCommand(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)

Select Case e.CommandSource.CommandName

Case "Picture"

Session("item") = Trim(e.Item.Cells(2).Text)

End Select

On the page_load of the popup.aspx I have
txtitemnumber.Text = Session("item")

And all the code for loading a picture that belongs to the item in
txtitemnumber.Text



The thing is every time I click on the Picture link, it opens my popup.aspx
and executes the page_load and after that it executes the Grid_CartCommand
function. It means that always I bring the data related to the previous item
selected, not the last item selected. I need to execute the CartCommand
function before and then open the popup window, this way I'll show the
information related to the item selected. Or I need a way of refreshing the
popup windows page after it's load and do this without having to press a
bottom because then it would mean that the user has to press a bottom for
refreshing which it's not helpful.

Please give me some ideas.

Thanks in advance

Jennyfer
 
D

Daniel Fisher\(lennybacon\)

<script language="c#" runat="server">
myDeleteButton.Attributes.Add("onclick",
"picWin = window.open('popup.aspx','picWin','height=350, width=300,status=
no, resizable=
no,scrollbars=no, toolbar=no,location=no,menubar=no ');")
</Script>

naming the window ('picWin') will solve your problem.

--Daniel Fisher(lennybacon)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,738
Latest member
JinaMacvit

Latest Threads

Top