General discussion

Locked

asp.net Problem with Drop Down Box

By dejan_zivanovic ·
I have a Web Form with few controls such as textboxes and drop down boxes among others.
This Web Form calls my Search Web Form using client scripting executed from button_click event
(Response.Write("<script language='javascript'>window.open('FindGroupItem.aspx?search=Contract&textbox=ContractID,txtContract,SupplierID,txtSupplier,CityID,txtCity,ddlItemType','Contract','scrollbars=yes,resizable=yes,width=790,height=500,left=0,top=0');</script>"))

When I get my results in search form, I post then to calling form using client scripting like this:

Public Sub DataGrid1_Item(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
If e.CommandName = "Select" Then
Dim sValue As String
sValue = ""

If InStr(control1.Value, ",") > 0 Then
Dim con() As String
Dim i As Integer

con = Split(control1.Value, ",")

For i = 0 To UBound(con)
If InStr(con(i), "ddl") > 0 Then
sValue = sValue + "window.opener.document.forms[0]." + con(i) + ".options.selectedIndex = " + Trim(GridTable1.Rows(e.Item.ItemIndex)(i + (CInt(ItemsDataSet.Tables("TABLE1").Rows(0).Item("searchHIDE")) - 1)).ToString()) + ";"
Else
sValue = sValue + "window.opener.document.forms[0]." + con(i) + ".value = '" + Trim(GridTable1.Rows(e.Item.ItemIndex)(i + (CInt(ItemsDataSet.Tables("TABLE1").Rows(0).Item("searchHIDE")) - 1)).ToString()) + "';"
End If
Next
Else
sValue = "window.opener.document.forms[0]." + control1.Value + ".value = '" + GridTable1.Rows(e.Item.ItemIndex)(1 + (CInt(ItemsDataSet.Tables("TABLE1").Rows(0).Item("searchHIDE")) - 1)).ToString() + "';"
End If

Dim strScript As String = "<script>"
strScript += sValue
strScript += "self.close();"
strScript += "</" + "script>"


RegisterClientScriptBlock("anythi", strScript)
End If
End Sub

I have no problem populating my text boxes with code

sValue = sValue + "window.opener.document.forms[0]." + con(i) + ".value = '" + Trim(GridTable1.Rows(e.Item.ItemIndex)(i + (CInt(ItemsDataSet.Tables("TABLE1").Rows(0).Item("searchHIDE")) - 1)).ToString()) + "';"

but populating drop down box with

sValue = sValue + "window.opener.document.forms[0]." + con(i) + ".options.selectedIndex = " + Trim(GridTable1.Rows(e.Item.ItemIndex)(i + (CInt(ItemsDataSet.Tables("TABLE1").Rows(0).Item("searchHIDE")) - 1)).ToString()) + ";"

does not work. Please Help.

This conversation is currently closed to new comments.

0 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Back to Web Development Forum
0 total posts (Page 1 of 1)  

Related Discussions

Related Forums