How to Add Button Image for Calender in MasterPage - c#

I have a page for employee which does insertion.There is a field called as datehired.It requires a calender.I don't know to insert a calender image for the button.I can add a image by writing this code
Likewise how to add an icon for button for calender
I am using Visual Studio 2010 framework 4.0
<asp:Image ID="Image1" runat="server" ImageUrl="BACKIMAGE.jpg" />

Related

Image button rendering using code behind in c#

I am trying to dynamically render image buttons. I need to display the below button
<asp:ImageButton runat="server" ID="ImageButton3" ImageUrl="~/Images/edit.png" OnClick="ImageButton3_click" CommandArgument='text'/>
The text is dynamically populated value. I have displayed the button as follow
<input type='button' id='ImageButton3' src='Images/edit.png' >
in the server side. but I am not able to add the onclick event and CommandArgument in server side.
I have to use the html tags for rendering.Can anyone help me? Thanks in advance

Asp .Net Web Forms removing postback from asp:linkbutton with inner HTML tags

I have created my first fully functional listview with custom action buttons, that worked fine when I used asp:buttons, but I need the buttons to be icons, so I tried inserting HTML tags inside, since it can't be done out of the box, I used as:linkbuttons controls to achieve the desired look.
What it does is that the buttons trigger several actions that populate controls inside update panels, and I have my own Javascript that shows a popup on click, but on the second action it currently sends a postback and page is reloaded, I googled other questions and tried everything they had, what I tried:
Adding a return false on client click
<asp:LinkButton runat="server" OnClientClick="showDialog('#popup'); return false;" CommandName="Detalles" CssClass="toolbar-button" ID="EditButton">
Editar
<span class="mif-pencil"></span>
</asp:LinkButton>
Using an HTML button with runat server, but Command doesn't trigger
<button runat="server" onclick="showDialog('#popup');" CommandName="Detalles" class="toolbar-button" ID="EditButton">
Editar
<span class="mif-pencil"></span>
</button>
And on jQuery, but doesn't do any difference
$('.toolbar-button').removeAttr('href');
What exactly I'm missing, my code works fine with Asp:buttons, but they can't have additional HTML :(, I'm a newbie on ASP, any hints are appreciated.
Working button that doesn't allow inside HTML
<asp:Button runat="server" Text="Detalles" CssClass="toolbar-button fg-darkCyan button-popup" ID="btn_detalles" CommandName="Detalles">
</asp:Button>
NOTE Buttons are inside a ListView control, and assigned for each item.

ajaxtoolkit calender extender won't show all the dates

im trying to make textbox which will handle different dates. For that im using ajaxtoolkit so that when a user clicks on the textbox a popup calender will appear beneath the textbox. I have managed to do that but the problem is that it only shows arond 18 days of the month and i would like to show all of the days in a month. I'm attaching a picture so you can see how it looks.
Here is the code:
<td><asp:TextBox ID="txtValidFrom" runat="server"TextMode="DateTime" >
</asp:TextBox></td>
<ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtValidFrom" FirstDayOfWeek="Monday" Format="dd/MM/yyyy" >
</ajaxToolkit:CalendarExtender>
It seems your CSS rules conflict with Calendar CSS rules.
You can strip all custom CSS to see that Calendar renders correctly and determine what code actually affects Calendar's CSS.

How to handle two different forms in an asp.net web page?

I have a login page in my asp.net website (using C#) and it has a "login form" which has an email text box, a password text box and a login button.
In addition, I have a "search form" at the top of the web page which has a search text box and a search button.
*All of the controls are in the same form because of the asp.net limit for one runat="server" form.
The problem is that when I type something to search for and click ENTER (and not directly the button) it doesn't do anything, only runs the Page_Load again. Same thing when I click ENTER in the login section instead of directly on the login button.
I have tried different solutions but they were problematic because of the different functionality of the two "forms".
I have no idea how to solve this, any suggestions?
my web forms is a little rusty but I think something like this:
<asp:Panel ID="loginPanel" runat="server" DefaultButton="loginButton">
<%-- Login Stuff--%>
<asp:Button ID="loginButton" runat="server" />
</asp:Panel>
<asp:Panel ID="loginPanel" runat="server" DefaultButton="searchButton">
<%-- Search Stuff --%>
<asp:Button ID="searchButton" runat="server" />
</asp:Panel>
should work
Only one form with runat='server' available on aspx page. So, if you really need another form, you may use its without runat='server' and use for search jQuery ajax call.

Problem with ModalPopupExtender in AJAX in asp.net c#

I have one form to save customer details.For that i have used updatepanel & formview. Also i used modalpopupextender to open popup in Click event of image button inside that form. But when i am using modalpopupextender then i cant save my customer details, without use of modalpopupextender i can save customer details. For that i have added code as following, but its giving error as "An extender can't be in a different UpdatePanel than the control it extends." :
<asp:ImageButton ID="imb1"
Text="Refresh Panel"
runat="server" />
<asp:ScriptManager ID="ScriptManager1"
runat="server" />
<asp:UpdatePanel ID="UpdatePanel1"
UpdateMode="Conditional"
runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="imb1" />
</Triggers>
<ContentTemplate>
// Here is my code to add
</ContentTemplate>
</asp:UpdatePanel>
Please help me what to do?
Asp.net c#
This error raises because your button which is used to open popup in updatepanel and your modal popup in any other update panel or you have placed it out of update panel.
Solution 1: place modal popup inside update panel in which your calling popup button exist.
solution 2: place button outside update panel and modal popup too.
Both things should be placed in same condition if button in update panel then popup should also be in same update panel And if button outside update panel then popup also outside update panel.
If you find your solution kindly mark my answer and point it up,thanks.
You're receiving this error because the TargetControlID, assuming it's the image button, resides outside of the update panel.

Categories