Conflict on submit button when Hit login submit button - asp.net

I have two submit button in various two purpose. When i hit enter button,but Top submit button only working. how can i rectify this problem. Please guide me. I hope you get my point.
My form is below this Url
http://i.stack.imgur.com/zLnxi.jpg

Try to use asp Panel control to group your login controls and SignUp controls. And set the DefaultButton property to your desired button. Here is sample code, how to use Panel
<asp:Panel ID="Panel1" runat="server" DefaultButton="ButtonOk">
<table >
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="ButtonOk" runat="server" Text="OK" />
</td>
<td>
<asp:Button ID="ButtonCancel" runat="server" Text="Cancel" />
</td>
</tr>
</table>
</asp:Panel>
I hope it will helps.

Related

Ajax Tab container in asp.net

I use two user controls in a tab container.user controls inside each tab panel.
I have registration forms in each user control.if i enter save button of one user control in a tab ,required field validator error coming in second tab panel registration form..how to solve it.
pls help
Add Validation Group property in each control. Then add validation group property in appropriate button.
So when u click on button only than button validation group controls get validated. e.g
<table width="400px">
<tr>
<td style="width: 80px;">
Name :
</td>
<td>
<asp:TextBox ID="txtName" ValidationGroup="tab1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ValidationGroup="tab1" runat="server" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td style="width: 80px;">
Father Name
</td>
<td>
<asp:TextBox ID="txtFatherName" ValidationGroup="tab1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ValidationGroup="tab1" runat="server" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td style="width: 80px;">
</td>
<td>
<asp:Button ID="btnValidate" runat="server" Text="Validate" ValidationGroup="tab1"
Width="80px" OnClick="btnValidate_Click" />
</td>
</tr>
</table>

Ajax UpdatePanel not working in IE9

I am using updatepanel to avoid the postback and the code is working fine in IE8 and firefox but not in IE9. I also tried installing latest ajax toolkit from codeplex but it did not help me either.Please help me with this. My code is something like below/....
<table width="800px">
<tr>
<asp:UpdatePanel runat="server" ID="upCountry">
<ContentTemplate>
<td class="TextLabelForHeader" width="300px">
Country:
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="ddlCountry"
ErrorMessage="*" InitialValue="Select.." ValidationGroup="VGHeader"></asp:RequiredFieldValidator>
</td>
<td align="left">
<asp:DropDownList ID="ddlCountry" runat="server" OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged"
AutoPostBack="true" OnDataBound="ddlCountry_DataBound" onchange="SelectCurrency(this);"
ValidationGroup="VGHeader">
</asp:DropDownList>
</td>
<td align="left">
</td>
</ContentTemplate>
</asp:UpdatePanel>
</tr>
<tr>
<asp:UpdatePanel runat="server" ID="upCurrency">
<ContentTemplate>
<td class="TextLabelForHeader" width="300px">
Currency:
</td>
<td align="left">
<asp:DropDownList ID="ddlCurrency" runat="server" ValidationGroup="VGHeader">
</asp:DropDownList>
</td>
<td align="left">
</td>
</ContentTemplate>
</asp:UpdatePanel>
</tr>
<tr>
<td class="TextLabelForHeader" width="300px">
Client:
<%--<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ControlToValidate="ddlClient" ErrorMessage="*" InitialValue="Select.."
ValidationGroup="VGHeader"></asp:RequiredFieldValidator>--%>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtClient"
ErrorMessage="*" ValidationGroup="VGHeader"></asp:RequiredFieldValidator>
</td>
<td align="left">
<%-- <asp:DropDownList ID="ddlClient" runat="server" Height="16px" Width="143px" Enabled="false"
OnDataBound="ddlClient_DataBound" onchange="DisplayTextbox(this);" ValidationGroup="VGHeader">
</asp:DropDownList>--%>
<asp:TextBox ID="txtClient" runat="server" Width="143px" ReadOnly="true" ValidationGroup="VGHeader"></asp:TextBox>
<%--<div id="form_ProductContainer" style="display: none;">
<asp:TextBox ID="txtNewClientName" runat="server"></asp:TextBox>
</div>--%>
</td>
<td class="TextLabelForHeader" style="text-align: left;">
<asp:Button ID="btnContinue" runat="server" OnClick="btnContinue_Click" Text="Continue"
ValidationGroup="VGHeader" />
</td>
</tr>
</table>
Discussion: Is it vital that it uses IE9 as is? If it isn't then you could just force it to render as IE8 with the following code inserted in the head section of the page or master page.
Possible Solution:
<meta http-equiv="X-UA-Compatible" content="IE=IE8" />
Updated Response
Identified Issue: I had a look at your code and you have no update Panel inside the last TR element. I imagine now that the code originally worked in IE8 because you probably had another update panel that covered the entire table.

ASP.Net CollapsiblePanelextender Control

Afternoon All,
I am wonding if i can configure and use a collapsiblePanelextender in ASP.net within a table. I would likt this to be used for a minutes of meeting system that i am creating. I have the following code and thought that if i added pnlPresenter and pnlTime to the CollapseControlID along with pnlHeader i would be able to get this to work but i cant.
Has anyone got any other suggestions?
<table width="100%">
<tr>
<td class="style3">Topic</td>
<td class="style2">Presenter</td>
<td>Time Alloted</td>
</tr>
<tr >
<td class="style1" colspan="3">
<asp:Panel ID="pnlHeader" runat="server" CssClass="cpHeader" Width="228%" Height="18px">
1. Agenda Item 1
<asp:Image ID="ImgToggle" runat="server" ImageUrl="~/Images/collapse.jpg" ImageAlign="Middle" />
</asp:Panel>
</td>
</tr>
<tr>
<td class="style3">
<asp:Panel ID="pnlInfo" runat="server" CssClass="cpBody" >
The Agenda topic details goes within here, The Agenda topic details goes within here,
The Agenda topic details goes within here, The Agenda topic details goes within here,.
</asp:Panel>
</td>
<td class="style2">
<asp:Panel ID="pnlPresenter" runat="server" CssClass="cpBody" Width="107px">
Presenters Name
</asp:Panel>
</td>
<td class="style2">
<asp:Panel ID="pnlTime" runat="server" CssClass="cpBody" Width="107px">
Time
</asp:Panel>
</td>
</tr>
</table>
Many Thanks in advance
Regards
Betty
It's not entirely clear what you want to achieve here, especially as there's no CollapsiblePanelExtender in the markup you've posted, so I'm writing this on the assumption that you want to display a page for a meeting where each agenda item is expandable/collapsible.
I suggest you build your table using a Repeater instead of hard-coding it into your page, then for each agenda item the Repeater can render a new row for you. Inside the row that's rendered by the Repeater, you can then have the agenda topic as a header, and the agenda item details as a panel that's expanded/collapsed using the extender:
<asp:Repeater runat="server" ID="AgendaRepeater" DataSourceID="AgendaDataSource">
<HeaderTemplate>
<table border="1">
<tr>
<td>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<asp:Label runat="server" ID="AgendaTopicLabel" Text='<%# Eval("Topic") %>' />
<asp:ImageButton runat="server" ID="PanelExpandContractImageButton" ImageUrl="~/images/zoom_in_16x16.gif" />
<asp:Panel runat="server" ID="AgendaItemDetailsPanel" Height="0px">
<asp:Label runat="server" ID="TopicDetailsLabel" Text='<%# Eval("Details") %>' /><br />
<asp:Label runat="server" ID="PresenterLabel" Text='<%# Eval("Presenter") %>' /><br />
<asp:Label runat="server" ID="TimeLabel" Text='<%# Eval("Time") %>' />
</asp:Panel>
<ajaxToolkit:CollapsiblePanelExtender runat="server" TargetControlID="AgendaItemDetailsPanel"
Collapsed="true" ExpandControlID="PanelExpandContractImageButton" CollapseControlID="PanelExpandContractImageButton"
ImageControlID="PanelExpandContractImageButton" CollapsedImage="~/images/zoom_in_16x16.gif"
ExpandedImage="~/images/zoom_out_16x16.gif" ExpandedSize="100" ExpandDirection="Vertical"
ScrollContents="true" />
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>

Open single pop up from two different buttons

I have two different buttons viz save and update. I want to open single pop-up window for both buttons, then how can I do so.? More over if pop-up is open on save buttons click then when ever it is closed, it should directed to OnClick_save() button event and if it is open from update buttons, on pop-up colse, it should directed to OnClick_Update() buttons click event.
How can I do so??
This is my code
<tr>
<td>
<table id="tblButton" runat="server">
<tr>
<td>
<asp:Button ID="btnAdd" runat="server" Text="Add" Visible="false" />
<asp:Button ID="btnUpdate" runat="server" Text="Update" Visible="false" /> <asp:Button ID="btnDelete" runat="server" Text="Delete" Visible="false" />
<asp:Button ID="btnTargetButton" runat="server" Text="PopUpTarget" Visible="false" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<cc1:ModalPopupExtender ID="ModalPopupExtenderSave" runat="server" TargetControlID="btnTargetButton" PopupControlID="passwordPopUp" DropShadow="true" PopupDragHandleControlID="header" BackgroundCssClass="modalBackground" BehaviorID="ModalPopupExtenderSave" />
</table>
<asp:Panel ID="passwordPopUp" runat="server" Style="display: none; padding: 10px;
border: 1px; border-style: solid;" BackColor="#91C83B" Width="300px" HorizontalAlign="Center"
BorderStyle="Solid" BorderWidth="5px">
<table class="TABLE100">
<tr>
<td colspan="3">
<h3 style="text-align: center;" id="header">
Confirm Password</h3>
</td>
</tr>
<tr>
<td colspan="3">
</td>
</tr>
<tr>
<td>
</td>
<td width="50px">
<asp:Label ID="lblPasswrd" runat="server" Text="Password" Font-Bold="True" Font-Size="Larger"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtPassword" runat="server" SkinID="TextBoxLong"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
<asp:Button ID="btnSubmit" runat="server" Text="SUBMIT" Width="70px" OnClick="btnSubmit_Click"/>
</td>
</tr>
</table>
</asp:Panel>
Some how I have solved the problem up to certain extent.
Now the problem is three different buttons viz. Insert, Update and delete buttons are responsible for opening pop-up window which in turn opens an ASP:panel the panel contains submit button. So on submit button, can I know which button was responsible for opening a panel.???
You can use a hidden button as modal popup's Okbutton and call then button OnClick from code. from both Save and Updated buttons.
add server side event handlers for each button click. use jquery to show popup for each button, that would be $('#button1').click and $('#button2').click from jquery.

defaultbutton is not working on my first panel, but works well with the rest of them?

I have a search panel in my master page, which seems to be getting called when typing in another panel and hitting enter, even though the panel has a different defaultButton. The weird thing is the second and third panels work well, which ever one I put at the top calls the search button.
My search panel in my master page
<asp:Panel runat="server" ID="pnlSearch" DefaultButton="btnSearch">
<asp:TextBox ID="txtSearch" CssClass="fld" runat="server" Width="160" Text="Search..."
onclick="this.value='';" CausesValidation="false"></asp:TextBox>
<asp:ImageButton ID="btnSearch" ImageUrl="~/Images/search_arrow.gif" runat="server"
OnClick="btnSearch_Click" CausesValidation="false" />
</asp:Panel>
and my other panels inside a control(only displaying two, the first one calls btnSearch, but the second one works fine.
<asp:Panel DefaultButton="btnViewPage" ID="pnlViewPage" runat="server" CssClass="floatLeft">
<table>
<tr class="adminRow">
<td class="adminLeftCol">
View Page:
</td>
<td>
<asp:TextBox ID="txtViewPage" Width="35px" runat="server"></asp:TextBox>
</td>
<td class="adminRightCol">
<asp:ImageButton ID="btnViewPage" runat="server" Text="Go" Width="75%" ImageUrl="~/Images/search_arrow.gif"
OnClick="btnViewPage_Click" ImageAlign="AbsBottom" CausesValidation="false" />
</td>
</tr>
</table>
</asp:Panel>
<asp:Panel DefaultButton="btnEditpage" ID="pn1Edit" runat="server" CssClass="floatLeft">
<table width="100%">
<tr class="adminRow">
<td class="adminLeftCol">
Edit Page:
</td>
<td>
<asp:TextBox ID="txtEditPage" Width="35px" runat="server"></asp:TextBox>
</td>
<td class="adminRightCol">
<asp:ImageButton ID="btnEditpage" runat="server" Text="Go" Width="75%" ImageUrl="~/Images/search_arrow.gif"
OnClick="btnEditpage_Click" ImageAlign="AbsBottom" CausesValidation="false" />
</td>
</tr>
</table>
</asp:Panel>
I've seen cases where the panel had to be inside an actual TD (the defaultbutton had to be a direct inner element of the panel). Have you tried this / can you try this?

Resources