Web Forms :: Imagebutton Control - Button Became Dark Blue And Others Remain No Changes When Click Any One
May 10, 2010
I want to put five buttons: introduction, product, history, feedback, contact. And when I click any one button, that button became dark blue, and others remain, no changes. So I write the following code:
Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
ImageButton1.ImageUrl = "~/image/CHOICE INTRODUCTION BLUE.jpg"
ImageButton2.ImageUrl = "~/image/CHOICE PRODUCTS.jpg"
ImageButton3.ImageUrl = "~/image/CHOICE HISTORY.jpg"
ImageButton4.ImageUrl = "~/image/CHOICE FEEDBACK.jpg"
ImageButton5.ImageUrl = "~/image/CHOICE CONTACT.jpg"
End Sub
Protected Sub ImageButton2_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton2.Click
ImageButton1.ImageUrl = "~/image/CHOICE INTRODUCTION.jpg"
ImageButton2.ImageUrl = "~/image/CHOICE PRODUCTS BLUE.jpg"
ImageButton3.ImageUrl = "~/image/CHOICE HISTORY.jpg"
ImageButton4.ImageUrl = "~/image/CHOICE FEEDBACK.jpg"
ImageButton5.ImageUrl = "~/image/CHOICE CONTACT.jpg"
End Sub
Protected Sub ImageButton3_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton3.Click
ImageButton1.ImageUrl = "~/image/CHOICE INTRODUCTION.jpg"
ImageButton2.ImageUrl = "~/image/CHOICE PRODUCTS.jpg"
ImageButton3.ImageUrl = "~/image/CHOICE HISTORY BLUE.jpg"
ImageButton4.ImageUrl = "~/image/CHOICE FEEDBACK.jpg"
ImageButton5.ImageUrl = "~/image/CHOICE CONTACT.jpg"
End Sub
Protected Sub ImageButton4_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton4.Click
ImageButton1.ImageUrl = "~/image/CHOICE INTRODUCTION.jpg"
ImageButton2.ImageUrl = "~/image/CHOICE PRODUCTS.jpg"
ImageButton3.ImageUrl = "~/image/CHOICE HISTORY.jpg"
ImageButton4.ImageUrl = "~/image/CHOICE FEEDBACK BLUE.jpg"
ImageButton5.ImageUrl = "~/image/CHOICE CONTACT.jpg"
End Sub
Protected Sub ImageButton5_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton5.Click
ImageButton1.ImageUrl = "~/image/CHOICE INTRODUCTION.jpg"
ImageButton2.ImageUrl = "~/image/CHOICE PRODUCTS.jpg"
ImageButton3.ImageUrl = "~/image/CHOICE HISTORY.jpg"
ImageButton4.ImageUrl = "~/image/CHOICE FEEDBACK.jpg"
ImageButton5.ImageUrl = "~/image/CHOICE CONTACT BLUE.jpg"
End Sub
It is workable, however there is only one problem: when i debug it some times it is ok, but some few times the button suddenly became small.
View 5 Replies
Similar Messages:
May 9, 2010
Please check this website: [URL]My question is that how can I make this effect: that hyper link(HOME) is on that dark blue background. How can I do it?
View 3 Replies
Oct 30, 2012
I want to create a logout session in asp.net?
How to clear history?
When we click on back button it should stay on same only....
View 1 Replies
Oct 13, 2010
On every web page I build, the first asp:button always has a blue border at runtime, even if I set another button as the default button. How do I make the default button have the blue border without making it the first button on the page, or get rid of the blue border on the first button?
View 2 Replies
Feb 1, 2011
click twice the imagebutton to fire?
[Code]....
View 1 Replies
Sep 30, 2010
I have a FileUpload control and a DropDownlist control in an UpdatePanel and when user select a file for the FileUpload control (no upload yet), in the meanwhile the user select an option from the DropDownList control which will cause a postback! Once the page postback, the path selected in the FileUpload control will gone. How can i remain the path in the FileUpload control? File uploading function was working. I hope can remain the path in the FileUpload control during postback.
I have tried the solution below but the "FileUpload1.HasFile" will return false to me.
If Session("FileUpload1") Is Nothing AndAlso Upload.HasFile Then
Session("FileUpload1") = Upload
lblPhotoUploadErr.Text = Upload.FileName
ElseIf Session("FileUpload1") IsNot Nothing AndAlso (Not Upload.HasFile) Then
[Code]....
View 6 Replies
Mar 7, 2010
I try to add a new ImageButton to my panel in a dynamic way -when the user click on button in the page.When i create the ImageButton i register to the click event.when the page load - i can to see the ImageButton but when i click on him is not fire the event.
[Code]....
[Code]....
View 2 Replies
Oct 5, 2010
I know this question has been asked before. But for some reason I can't find the exact answer I need for my problem. My problem is as follows:
I am creating a web page (The one posted is just an easy example) that creates multiple ImageButtons on one page via a loop.I have tried many other ways (for example, create instance in form_load and pass to the WriteHtml() method) but I can't figure out a way to complete this. In this example I have 10 buttons that need to be able to be clicked.
The code is as follows:
[Code]....
View 4 Replies
Mar 16, 2011
The image button below does not respond the first time I click it -
note - it is rendered visible programatiocally before use.
<asp:ImageButton
ID="imgCloseHelp2"
runat="server"
ImageAlign="Right"
ImageUrl="~/Images/CloseIcon15x15px.jpg"
Visible="false"
style="
float:left;
padding-right:
10px;"
OnClick="imgCloseHelp2_Click"
/>
View 11 Replies
Nov 15, 2010
I have a Formview InsertTemplate a dropdownlist with datasource1 and I want onclick of an imagecontrol the dropdownlist will display another set of data from datasource2 instead.
Protected Sub ImageOnClick1(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
Dim dropdownlist1 As DropDownList = CType(FormView1.FindControl("dropdownlist1"), DropDownList)
[code]...
View 3 Replies
Dec 15, 2010
I try to add new control ( say label for example ) in one page, using button or any order in other page, or in the same page not matter ,is that possible ?also I want to add this control in specific position in the page,and I want if that possible to delete some control from page using other button in other page or in the same pagethese to facilitate my idea this is the page as startand after i use buttons in this page, first page will include new label under or above the first one like this
View 4 Replies
Jun 4, 2013
I have a web app I'm creating and a form that has a formview control on it. The form's default is set to insert and when the user enters data and clicks save, the data gets saved to the database; only problem is that the form then clears all the data out of the controls.
Upon saving after updating or inserting, I'd like to set the form mode to edit and also have it retain the values they input into the form. I've tried a few things and have not had any luck.
e.g.
Code:
Protected Sub frmCustomerInformation_ItemInserted(sender As Object, e As FormViewInsertedEventArgs)
' Make sure record inserted properly.
If e.Exception Is Nothing Then
If e.AffectedRows > 0 Then
litMessage.Text = "Customer Information saved."
'GETTING THE NEW quoteCustomerInformationId FROM THE SAVED RECORD AND PLACING IT INTO A SESSION VAR.
[Code] ....
What mode does the formview control have by default after it executes the ItemInserted method? Also, what is the prper way to do this?
View 2 Replies
Jun 4, 2010
I have written a user control that captures some user input and has a Save button to save it to the DB. I use a repeater to render a number of these controls on the page - imagine a list of multiple choice questions with a Save button by each question.
I am loading the user control inside the repeater's ItemDataBound event like this (code simplified):
[code]....
The problem is that when the Save button is clicked, the page posts back, but lbnUpdate_Click is not called. The Page_Load event of the page itself is called however.
I should mention that the repeater is part of a user control, and that user control is loaded inside another user control (this is a DotNetNuke site which makes heavy use of user controls). The Save button link looks like this:
javascript:__doPostBack('dnn$ctr498$AssignmentsList$rptAssignments$ctl04$ctl00$lbnUpdate','')
View 3 Replies
Mar 22, 2011
OK, been burning up Google and Bing trying to figure out a good solution to this problem, and so far, I feel like I've taken a dive down a rabbit hole - I'm just waiting on the Queen of Hearts and the Mad Hatter to show up. Alice is kinda cute, but unfortunately, she didn't have any good suggestions, either.
Here's the scenario - I have a User Control on a Child Page that has a Master Page assigned. The control is for logging in to the system, so it contains two text boxes, a couple of links to password recovery and registration, and an ImageButton to handle submission of the username/password entered in the text boxes.
Everything works just as expected when the user actually takes the mouse and clicks on the ImageButton control.
Things don't work so well when the user enters a username and password and then presses the Enter/Return key.
While debugging, VS2005 (I know...ugh!) will stop at the LoginButtonClick event, and seems to run the code. Of course, the .Text property of the two input controls was empty, but the Request.Form collection had the values burried within the collection of Keys.
So, a little bit of digging got me to the point where they can login using either the Enter key or clicking on the ImageButton. So, everything seems like it's good, right? Nope, not so fast.
When I enter a username/password combo that's designed to fail authentication, the code will step through setting the error message, etc, but that information never makes it to the point where it's visible to the user.
I'm not seeing any extra postbacks (obvious ones, anyway), but for some reason, when the page goes to redraw when it's in a "failed" state, the notations just simply aren't there.
Below is the code in the User Control that handles the actual authentication routine. All controls, such as the Label with ID "message", are local to the User Control, so I don't think it's a FindControl("message") problem or something similar...just so bizarre that it disappears seeming without reason.
[Code]....
View 2 Replies
Mar 2, 2010
I have a gridview that has a column with an imagebutton. That image button event calls my update procedure and merely updates that records status and when the gridview rebinds, the image changes and is no longer available.Whats happening is if the page is refreshed, the update occurs again. If i add this around the update code, works great the first time, but then any other updates are ignored.. is there anyway to know wether the page was refreshed vs actual imagebutton postback?
if (!IsPostBack)
{
}
Since the update is just setting a flag for that record, on another page that displays those records for a seperate department. IF by chance the first page is still open and the 2nd department resets the flag, if the first page is refreshed, that flag is reset again. so its creating some inconsistant results..
View 7 Replies
Feb 7, 2011
I am using vs 2008 in my wepage i have one update button which is not fired in first click i deleted all coding and tried for this simple line coding for this also not firing in first click
protected void btn_update_Click(object sender, EventArgs e)
{
Label_error.Text = "Updated";
}
View 8 Replies
Feb 10, 2010
I hate this bugs in Visual Studio..I have this code:
[Code]....
Click event is not triggering. This is the head of aspx file:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="wucIskalnik.ascx.cs" Inherits="indcms.datapages.wucIskalnik" %>
I don't have an idea what the hell happens just imeddiately that so simple stuff don't want to work.I use some javascript jquery too, and I tried to remove all JavaScript, still the same.. Deleted button and events, reapplied them on page, still not triggering Click event.. Wth?
View 7 Replies
Apr 27, 2016
i have searched on google and got an article [URL] keep selected file in fileupload control even after page postback. But it's not working at all. So is there any way through which we can keep selected files in fileupload even after page postback.?
View 1 Replies
Nov 20, 2010
i have some textbox that i validate with a customvalidator control (only, and must be, server side function) and i have an imagebutton control for submit.I must stop the postback if there are some errors in the validation function.I set the validation property argumets.isvalid = false in the customvalidator function but doesn't work, the postback continue.i have tried to set the imagebutton property postbackurl = "" in the validation function but doesn't work.
View 8 Replies
Jan 22, 2010
default.aspx page has multiview and view controls and a button control.
when click the button an .ascx file loaded dynamically on view control.
codes are goes here :
in default.aspx
[Code]....
[Code]....
View 2 Replies
Feb 9, 2011
i was struck totally when i am trying to dynmically show fileupload control on button click...here is my scenario of my flow....
initially i will be showing only one fileupload control...and if the user wants to upload more files he will click on add more button so that it should dynamically show another fileupload...
like wise he should be able to upload upto 40 files max.
View 4 Replies
Feb 3, 2010
I have two user control..In one user control i have a button..if i press the button i want to load another user control
View 2 Replies
Mar 7, 2012
I have this code that display a message when a button is click, but i am having more that one button on the form, how do i control the message base on the different button click.
View 1 Replies
Jun 30, 2010
a problem with firing click event when asp:button control is click on IE8. Its properly postedback but when i click button in IE8, it does'nt do any thing. After review on mouseover on button the the following type link showing on button pagename.aspx?vid=18 on next click it incremented pagename.aspx?vid=18&vid=18 and so on. How can i fix button problem in IE8.
View 6 Replies
Apr 19, 2012
how to open a calendar control in asp.net web form on the image button click and display the date in the textbox
View 1 Replies