I forgot to add to the above post that I just created a gridview template with a standard link button and inserted the java popup code into the OnClientClick event on the asp.net page.
My idea was the popup would happen just as a normal popup window, then the code file of the destination page would go back to the source page and extract the selected value from the gridview.
I went though the tutorials for the AJAX popup control extenders, and from I saw they are not what I need, they are not as flexable as creating a completely stand alone aspx page.
Hey DK a sample would be great, since I am not following what you mean.
A friend pointed out the option of possible using a floating div, another friend gave me an option that I am pretty sure will work and if all else fails I will do it, but I think it's going to end up being a lot of coding and rather messy.
Partial Public Class ucCategoryDetails
Inherits System.Web.UI.UserControl
Private _Cat_ID As String
Public Property Cat_id() As String
Get
Return _Cat_ID
End Get
Set(ByVal value As String)
_Cat_ID = value
Me.odsSubCat.SelectParameters("Cat_ID").DefaultValue = CInt(Cat_id)
Protected
Sub GridView2_RowDataBound(ByVal sender
As Object,
ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
Handles GridView2.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow
Then
Dim hl
As HyperLink =
DirectCast(e.Row.FindControl("idTracking"), HyperLink) hl.NavigateUrl =
"javascript:" + hl.NavigateUrl
End If
End Sub
But still the illusive thing is just getting the ItemID into the
Url Query string, why is this so difficult it makes me shake my head I can't be the only person in the world trying to do this...lol
Fist I replace my Gridview with a Repeater, I just created the same look as the gridview using a table then dropped the table into the Repeater template.
Protected
Sub ItemData_ItemDataBound(ByVal sender
As Object,
ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs)
Handles ItemData.ItemDataBound
Dim hl As LinkButton =
DirectCast(e.Item.FindControl("ItemLink"), LinkButton)
hl.OnClientClick =
"javascript:window.open('../ItemDetail/Default.aspx?ItemID=" & hl.OnClientClick &
"', 'MyWindow', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,location=0,left = 390,top = 362,width=500,height=300');"
End Sub
When the link button is clicked it runs the window.open command and inserts the ItemID
Rivelyn
Participant
1026 Points
560 Posts
Re: Java Pop-up window from GridView Row Selection
Jun 26, 2007 07:28 PM|LINK
I forgot to add to the above post that I just created a gridview template with a standard link button and inserted the java popup code into the OnClientClick event on the asp.net page.
My idea was the popup would happen just as a normal popup window, then the code file of the destination page would go back to the source page and extract the selected value from the gridview.
Rivelyn
Participant
1026 Points
560 Posts
Re: Java Pop-up window from GridView Row Selection
Jun 26, 2007 07:59 PM|LINK
I went though the tutorials for the AJAX popup control extenders, and from I saw they are not what I need, they are not as flexable as creating a completely stand alone aspx page.
DkUltra
Contributor
2813 Points
546 Posts
Re: Java Pop-up window from GridView Row Selection
Jun 26, 2007 09:14 PM|LINK
That was my thought by using a usercontrol in the Ajax popup
a usercontrol is like a standalone asp page.
Is a sample required?
DK
Rivelyn
Participant
1026 Points
560 Posts
Re: Java Pop-up window from GridView Row Selection
Jun 27, 2007 12:24 PM|LINK
Morning,
Hey DK a sample would be great, since I am not following what you mean.
A friend pointed out the option of possible using a floating div, another friend gave me an option that I am pretty sure will work and if all else fails I will do it, but I think it's going to end up being a lot of coding and rather messy.
Rivelyn
Participant
1026 Points
560 Posts
Re: Java Pop-up window from GridView Row Selection
Jun 27, 2007 01:20 PM|LINK
So I found this tid-bit of code on some obscure forums that apparently does the trick of passing a value to a java popup window here is is.
<ItemTemplate> <a href="javaScript:openWin('../ItemDetail/Default.aspx?ItemID=<%=rsSearch("ItemID")%>','toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0')">Details</a> </ItemTemplate>The only problem is I have no idea what the code is referencing here rsSearch
DkUltra
Contributor
2813 Points
546 Posts
Re: Java Pop-up window from GridView Row Selection
Jun 27, 2007 01:53 PM|LINK
Hi, the following is a complete sample. I would assume rsSearch is a function defined as <script> rsSearch(var id) { } </script>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="CategoryID" DataSourceID="ObjectDataSourceCategory"
CellPadding="4" ForeColor="#333333" GridLines="None" Font-Size="8pt" Font-Names="Verdana"
Width="100%" EmptyDataText="There are no categories defined" PageSize="10">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="btnDetails" runat="server" Text="Details" CausesValidation="false" />
<asp:LinkButton ID="btnDelete" runat="server" Text="Delete" CausesValidation="false"
CommandName="Delete" />
<asp:Panel ID="pnlPopup" CssClass="catdetpopup" Width="450px" runat="server" Style="display: none;"
Visible="true">
<div style="width: 100%; height: auto; background-repeat: repeat-x; color: Black;
font-family: Calibri" id="dragdiv" runat="server">
<div style="float: right">
<asp:Image runat="server" ID="btnClose" ImageUrl="/globalimages/close_button.gif" />
</div>
<div style="padding: 10px">
<uc1:ucCategoryDetails ID="CategoryDetails1" Cat_id='<%# Eval("CategoryID")%>' runat="server">
</uc1:ucCategoryDetails>
</div>
</div>
</asp:Panel>
<cc1:ModalPopupExtender ID="mdlpopup1" runat="server" TargetControlID="btnDetails"
PopupControlID="pnlPopup" BackgroundCssClass="popupbackground" DropShadow="true"
Drag="true" PopupDragHandleControlID="dragdiv" CancelControlID="btnClose" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="CategoryID" HeaderText="CategoryID" InsertVisible="False"
Visible="False" ReadOnly="True" SortExpression="CategoryID" />
<asp:BoundField DataField="CategoryName" HeaderText="Category Name" SortExpression="CategoryName" />
<asp:CheckBoxField DataField="IsActive" HeaderText="Active" SortExpression="IsActive" />
</Columns>
</asp:GridView>
Css
.catdetpopup
{
width:500px;
height:auto;
border:1px solid black;
background-color:White;
}
UserControl codebehind
Partial Public Class ucCategoryDetails
Inherits System.Web.UI.UserControl
Private _Cat_ID As String
Public Property Cat_id() As String
Get
Return _Cat_ID
End Get
Set(ByVal value As String)
_Cat_ID = value
Me.odsSubCat.SelectParameters("Cat_ID").DefaultValue = CInt(Cat_id)
End Set
End Property
End Class
Hope this Helps
DK
Rivelyn
Participant
1026 Points
560 Posts
Re: Java Pop-up window from GridView Row Selection
Jun 27, 2007 03:04 PM|LINK
Thanksd to this post http://forums.asp.net/t/1126878.aspx
I think I am getting closer.
So far Source Page has these peices of code,
<script type="text/javascript"><!-- Begin
function popUp(URL) {day = new Date();id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300,left = 390,top = 362');");}
// End -->
</script>Followed by the gridview template.
<ItemTemplate>
<asp:HyperLink ID="idTracking" runat="server" Style="position: relative" Text='<%# Eval("ItemID") %>' NavigateUrl="popUp('../ItemDetail/Default.aspx?ItemID=')"></asp:HyperLink> </ItemTemplate>Followed by the VB code behind.
Protected Sub GridView2_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView2.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then Dim hl As HyperLink = DirectCast(e.Row.FindControl("idTracking"), HyperLink) hl.NavigateUrl = "javascript:" + hl.NavigateUrl End If End SubBut still the illusive thing is just getting the ItemID into the Url Query string, why is this so difficult it makes me shake my head I can't be the only person in the world trying to do this...lol
Rivelyn
Participant
1026 Points
560 Posts
Re: Java Pop-up window from GridView Row Selection
Jun 27, 2007 03:07 PM|LINK
Thanks DK, I will give this a go. Seems we are posting at the same time.
Rivelyn
Participant
1026 Points
560 Posts
Re: Java Pop-up window from GridView Row Selection
Jun 28, 2007 08:42 PM|LINK
OK partially thanks to this post http://forums.asp.net/t/1126878.aspx I was able to figure this out and it works like a charm.
Fist I replace my Gridview with a Repeater, I just created the same look as the gridview using a table then dropped the table into the Repeater template.
It looks like so,
<
asp:Repeater ID="ItemData" runat="server"> <ItemTemplate> <table border="0" cellpadding="0" cellspacing="0" style="width: 95%; position: relative;"> <tr> <td align="left" style="border-bottom: dimgray 1px dotted" valign="middle"> <asp:LinkButton ID="ItemLink" runat="server" OnClientClick='<%# Eval("ItemID") %>' Style="position: relative" Text='<%# Eval("ItemName") %>'></asp:LinkButton> </td> </tr> </table> </ItemTemplate> </asp:Repeater>And the code beside looks like this,
Protected Sub ItemData_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles ItemData.ItemDataBound Dim hl As LinkButton = DirectCast(e.Item.FindControl("ItemLink"), LinkButton)hl.OnClientClick =
"javascript:window.open('../ItemDetail/Default.aspx?ItemID=" & hl.OnClientClick & "', 'MyWindow', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,location=0,left = 390,top = 362,width=500,height=300');" End SubWhen the link button is clicked it runs the window.open command and inserts the ItemID
Thanks Everyone!
robertmazzo
Participant
1030 Points
347 Posts
Re: Java Pop-up window from GridView Row Selection
Jul 03, 2007 05:00 PM|LINK
My appologies for not having seen your response to me. I'll just post the ViewOrder js routine that I use :
function ViewOrder(nOrder, SubmitType){
var hidClient = document.getElementById(hidClientAliasID);
var hidUser_Id = document.getElementById(hidUser_IdAliasID);
var cClient = hidClient.value;
var cUser_Id = hidUser_Id.value;
var cBranch = "";
var WindowName = (SubmitType == "New" ? "SubmitNew" : "SubmitCancel");
//window.alert(nOrder + "/" + SubmitType);
OrderModWin = window.open("AddModifyOrder.aspx?ticket=" + escape(nOrder) + "&branch=" + escape(cBranch) + "&client=" + escape(cClient) + "&user_id=" + escape(cUser_Id), WindowName, 'scrollbars=no,toolbar=no,height=410,width=880,alwaysRaised=yes,resizable=yes,location=no, status=no,screenX=400,screenY=410');
}