Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function that uses values from ASP.Net form

Status
Not open for further replies.

dolfo35

Programmer
Jan 26, 2001
28
US
Hello,

I am opening a popup window with this function:

Code:
function newWindowEvent(Page)
{
	var winl = (screen.width - 400)/2;
	var wint = (screen.height - 400)/2;
	var settings = "height=400,width=400,toolbar=1,location=1,top="+wint+",left="+winl+"";
	var x = window.open(""+Page+"","sub",settings);
	x.focus();
}

Here is the code that fires the onclick event:

Code:
btnUpdateEvent.Attributes.Add("onclick", "newWindowEvent('salPopupEvent.aspx?contractkey=" + PassContractKey + "&contracthistorykey=" + strContractHistoryKey + "', 'txtbox');")

As you can tell, I attempting to pass two parameters PassContractKey and strContractHistoryKey. I have the value of the first one and see it in the url of the resulting window. What I need help with is the second one.

The way that I am getting the value of the second one is by using the RowSelectorColumn. Here is my question: How can I use this same newWindowEvent function to grab this information? In VB.Net I would grab it this way:

Code:
Dim rscParty As RowSelectorColumn = RowSelectorColumn.FindColumn(grdContractParties)

Dim selectedIndex, intCheck As Integer

' Check to see if any radio buttons have been selected
intCheck = rscParty.SelectedIndexes.Length
If intCheck > 0 Then
    selectedIndex = rscParty.SelectedIndexes(0)
End If

Dim ContractPartyKey As String = grdContractParties.DataKeys(selectedIndex).ToString

This may not be a clear explanation, so if I need to fill in any blanks please let me know. Any help is greatly appreciated!!!

Rudy
 
If strContractHistoryKey needs to be obtained server-side, then you would need to ask in the forum related to your server-side technology.

If client-side, then you would need to show your form HTML.

Dan


[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Thank you for kindly letting me know that there are other forums. However, the answer just so happened to be 50% Javascript, 50% ASP.NET (datagrid).

Code:
Private Sub grdContractEvents_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles grdContractEvents.ItemCommand

Dim ContractEventKey As String

ContractEventKey = grdContractEvents.DataKeys(e.Item.ItemIndex).ToString

Response.Write("<script language=javascript>window.open('salPopupEvent.aspx?contractkey=" + PassContractKey + "&contracthistorykey=" + ContractEventKey + "');</script>")

End Sub

So, I added a button column to the datagrid and put the Javascript call in its ItemCommand event.

I apologize for taking up space in your forum.

Have a great day!
Rudy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top