Thanks, dvannoy, I guess I could do that but would it slow my application down at all? Also, I'd rather avoid a postback, knowing what I know now, which brings me to...
Ok, so I've been doing some research and determined that since I'm using asp.net 2.0, a client callback should work. (Thanks, Oddball, I found this out by following my nose throught the link you provided.)
That's about all I've figured out.
I've been trying to piece something together from various tutorials, examples etc. from all over the web, but I'm not having much luck. This is mostly because I don't know much about javascript.
I'm desperately trying to learn, and trust me I've been googling furiously and reading everything I can get my hands on (I've always thought that people who don't try to help themselves first really don't deserve the help of others) but I just don't know where to go from here.
This is what I have (mostly taken from
Dim _callBackResult As String
In Page_Load:
Dim callBack As String = Page.ClientScript.GetCallbackEventReference(Me, "arg", "ClientCallback", "context", "ClientCallbackError", False)
Dim clientFunction As String = "function GetChildren(arg, context){ " & callBack & "; }"
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "GetChildren", clientFunction, True)
If Page.IsPostBack AndAlso Not Page.IsCallback Then
Dim territory As DropDownList
territory = CType(Me.DetailGrid.FindControl("ddlterritory"), DropDownList)
If _callBackResult <> "" Then
territory.SelectedValue = _callBackResult
end if
End If
Public Function GetCallbackResult() As String Implements System.Web.UI.ICallbackEventHandler.GetCallbackResult
Return _callBackResult
End Function
Public Sub RaiseCallbackEvent(ByVal eventArgument As String) Implements System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent
'Here I get the territoryID for the Company and store it in a variable of the same name
_callBackResult = territoryID
End Sub
In <script> portion of my contentplaceholder:
function ClientCallback(result, context){
'Not really sure what goes here, obviously that is a BIG problem!
}
function ClientCallbackError(result, context){
alert(result);
}
Can anyone explain to me what I need to do to achieve the results I need??