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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling a function on change. Little help ;)

Status
Not open for further replies.

Mesk69

Programmer
Feb 6, 2003
12
CA
I'm having a problem with an aspx. I'm just learning how to use aspx and I can't seem to find my problem. In my page I have the following function and I call it with the statement that follows.

I'm looking at alternate ways to fix this. If the problem is obvious I'd appreciate the help.

Thanks for taking the time to read ;P

Frank



private sub DisplayCourse(sender As Object, e As System.EventArgs)
BindData("Maurice, Lafleur")
end sub

<asp:dropdownlist id=&quot;ddlTeacher&quot; runat=&quot;server&quot; DataTextField=&quot;name&quot; DataValueField=&quot;t_no&quot; OnSelectedIndexChanged=&quot;DisplayCourse&quot;>
</asp:dropdownlist>
<asp:datagrid id=&quot;dgCourseWorkload&quot; OnItemDataBound=&quot;dgCourseWorkload_ItemDataBound&quot; OnDeleteCommand=&quot;dgCourseWorkload_Delete&quot; OnCancelCommand=&quot;dgCourseWorkload_Cancel&quot; OnUpdateCommand=&quot;dgCourseWorkload_Update&quot; OnEditCommand=&quot;dgCourseWorkload_Edit&quot; EditItemStyle-BackColor=&quot;#eeeeee&quot; EditItemStyle-Font-Size=&quot;12px&quot; ItemStyle-Font-Size=&quot;12px&quot; HeaderStyle-Font-Size=&quot;14px&quot; HeaderStyle-Font-Bold=&quot;True&quot; HeaderStyle-HorizontalAlign=&quot;Center&quot; HeaderStyle-ForeColor=&quot;White&quot; HeaderStyle-BackColor=&quot;Black&quot; CellPadding=&quot;4&quot; AutoGenerateColumns=&quot;False&quot; DataKeyField=&quot;CourseCode&quot; Runat=&quot;server&quot;>
 
Couple questions for you.

Are you using code behind or spaggetti style coding.

If your using code behind make sure to set autopostback to true. Add the line Handles ddlTeacher.SelectedIndexChanged to the end of your sub name line (forgotten proper term) like so


private sub DisplayCourse(sender As Object, e As System.EventArgs) Handles ddlTeacher.SelectedIndexChanged



If your using spaggetti code make sure that the sub is within the server code tags <%...%>.

I do advise using code behind. There have been a few threads here you can find on the advantages and disadvantages of both methods. Conclusion is always to use code behind if at all possible. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top