473,396 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Second button does not work

I have two drop down boxes and one list box. My client wants the patrons to either search for authors from a drop down box that lists all the authors or from the list box that displays a list of authors based on the genre. The individual authors add button does not work. I get an error message that states: Exception has been thrown by the target of an invocation.

Here is my code:

Expand|Select|Wrap|Line Numbers
  1. protected void AddAnAuthor(object sender, EventArgs e)
  2.     {
  3.         AddAuthors_ds.Insert();
  4.         OneAuthorList_lb.ClearSelection();
  5.         Response.Redirect(Request.Url.AbsoluteUri);
  6.     }
  7.    protected void AddAuthors(object sender, EventArgs e)
  8.     {
  9.         AddAuthors_ds.Insert();
  10.         AuthorList_lb.ClearSelection();
  11.         Response.Redirect(Request.Url.AbsoluteUri);
  12.     }
  13.  
Expand|Select|Wrap|Line Numbers
  1. <asp:DropDownList runat="server" ID="OneAuthorList_lb" style="float:left;" DataSourceID="AuthorList" DataTextField="AuthorName" DataValueField="AuthorName"  onselectedindexchanged="AddOneAuthor_SelectedIndexChanged" 
  2.                  AutoPostBack="True" AppendDataBoundItems="true" />
  3. <asp:ImageButton ImageUrl="add.png"  OnMouseOver="addHover.png'" runat="server"  ID="AddAnAuthor" style="float:left; margin-left:5px;" OnClick="AddAnAuthor" />
  4.  
  5. <asp:DropDownList runat="server" ID="AuthorsList" 
  6.                  style="float:left;" DataSourceID="AuthorsList_ds" 
  7.                  DataTextField="AuthorName" DataValueField="AuthorName" 
  8.                  onselectedindexchanged="AuthorsList_SelectedIndexChanged" 
  9.                  AutoPostBack="True" AppendDataBoundItems="true">
  10.     <asp:ListItem Text="Select Genre" Value="~Select Genre~" />         
  11. </asp:DropDownList> 
  12. <asp:ImageButton ImageUrl="add.png'" ToolTip="Add Authors From List" runat="server"  ID="btnAddAuthors" style="float:left; margin-left:5px;" OnClick="btnAddAuthorsListed" />
  13.  
  14.        <asp:ListBox runat="server" ID="AuthorList" DataTextField="AuthorName" 
  15.             DataValueField="UserID" DataSourceID="Authors" SelectionMode="Multiple"  AppendDataBoundItems="true" />
  16.  
How do I resolve the error and meet my client's requirement to allow library patrons to use either button? Both buttons need to fire the same event.
Jan 20 '14 #1
0 985

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: esoroka | last post by:
Hello, Trying to run a script what start ASP button: document.Form1.all.click(); It is work one time only. Next script ignore it. Where can be problem??? A full script is as follows:
3
by: David | last post by:
Hi, I have 3 buttons on a asp.net page. They are exactly the same except for the name. Two of the buttons works but the third one does not respond to the clicking. Here is the code: <tr> <td...
0
by: Ganesh Raju via .NET 247 | last post by:
Hi, I have a dropdownlist and a button on my aspx page. If i havemore than 90 items in the dropdownlist my button does not dopostback. If there are less than 80 items in the dropdownlist,same...
1
by: RUIZCJ | last post by:
Hi, I'm at my wits end!!! I have the following code. The submit button works on my home computer but when I copy the dll and the ASPX file to my host provider, the button does NOT fire. TIA...
8
by: tatemononai | last post by:
I had a beautiful script that was running, well, just beautifully. But then I decided to take a button that fired an event and place it inside a <asp:table. The event WILL NOT FIRE INSIDE THE...
4
by: nicholas | last post by:
Weird thing: Got an aspx page with a button and an associated code in VB.net. On my testing server the page works fine. On the old hosters server the page worked fine too. But now, at the new...
0
by: sql | last post by:
I have an ASP .NET (Visual Studio 2005) page which is dynamically built using 3 repeaters. I have one button on the page which is used to perform a search. The button does not always fire the code...
1
by: jobs | last post by:
I've been staring at this and can't explain why it's not working. The grid shows up fine, except the last column, Reset User button does not render??? I checked the codebehind and I am not...
2
by: RoxyBeginner | last post by:
I got every other operation button to work besides sqrt, and percentage. I've done the same thing for addition, subtraction, etc. and it doesn't seem to work. here's my globals Public Class...
2
by: mroberts50 | last post by:
I have to develop a programm for a race that is suppose to put the runners in first, second and third place. Everything works except my calculate button this is my code.Forgive me I am very new to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.