how to use Autocompleteextender in modal popupextender - css

I am using autocompleteextender in a modalpopupextender....the dropdown in auto complete is shown in background....this problem occured in chrome....in firefox give expected output......
My code is....
<asp:TextBox ID="txtpincode" runat="server" TabIndex="1"
CssClass="autotxtbx" AutoPostBack="True" OnTextChanged="txtpincode_TextChanged"
onchange="AutoClear()" Width="100"></asp:TextBox>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1"
TargetControlID="txtpincode" ServiceMethod="getpincode"
MinimumPrefixLength="1" OnClientItemSelected="ItemSelected"
FirstRowSelected="true" runat="server" CompletionListItemCssClass="autocmpl"
CompletionListHighlightedItemCssClass="autotxt" UseContextKey="True" />
<asp:HiddenField ID="hdnUserField" runat="server" />
I use this in a modal popup extender....the resul in chrome is....!

Yes the only issue was with the AutoCompleteType. You can do it like this.
`AutoCompleteType="Disabled"`

Related

ASP.NET Repeater FindControl not working for Label, but works for Textbox

I'm facing issues trying to get controls from my repeater. I have one label and one textbox. The label is giving me a null reference error, however the textbox is working.
Markup:
<asp:Repeater ID="PalletsRepeater" runat="server" OnItemDataBound="PalletsRepeater_ItemDataBound">
<ItemTemplate>
<div style="margin-left: 20px; margin-top: 5px;">
<asp:Label lbl="lblPalletId" Text='<%#"Pallet "+Eval("PALLETID")%>' runat="server" />
<asp:Label Text=", Qty = " CssClass="field-label-blue" runat="server" />
<asp:TextBox ID="txtPalletItemQty" runat="server" Text='<%# Eval("ITEMQTY") %>' step="1" type="number" />
</div>
</ItemTemplate>
</asp:Repeater>
Code Behind:
foreach (RepeaterItem repeaterRow in PalletsRepeater.Items)
{
// This fails.
string palletId = ((System.Web.UI.WebControls.Label)repeaterRow.FindControl("lblPalletId")).Text;
// This works.
string palletItemQty = ((System.Web.UI.WebControls.TextBox)repeaterRow.FindControl("txtPalletItemQty")).Text;
}
I have researched this on Stack Overflow and most answers involve using the OnItemDatabound event, but when I tried to implement those answers, it still comes back null for the label. Personally I don't understand the suggestions as far as using the OnItemDatabound event.
Change
<asp:Label lbl="lblPalletId" Text='<%#"Pallet "+Eval("PALLETID")%>' runat="server" />
Into
<asp:Label id="lblPalletId" Text='<%#"Pallet "+Eval("PALLETID")%>' runat="server" />
You cannot find it because it has no ID

my balloon pop up doesn't work

I am using a pop up but it cant show any thing in final render.
Can any body tell me what is wrong in my cods:
Thank you very much
Here is my code:
panel cod:
<asp:Panel ID="Panel2" runat="server">
<b> Test.</b>
</asp:Panel>
balloon pop up code:
<asp:BalloonPopupExtender ID="len_BalloonPopupExtender" runat="server" BalloonPopupControlID="Panel1"
CustomCssUrl="" DisplayOnClick="False" DisplayOnMouseOver="True" DynamicServicePath=""
Enabled="True" ExtenderControlID="" TargetControlID="len" DisplayOnFocus="False"
BalloonStyle="Rectangle">
</asp:BalloonPopupExtender>
textbox code:
<asp:TextBox ID="len" onmouseout="this.BalloonPopupControlBehavior.hidePopup();" runat="server" BorderColor="#3399FF" BorderStyle="Groove" BorderWidth="2px" Width="50" AutoPostBack="true" TabIndex="2" MaxLength="4"></asp:TextBox>
And one more thing is that i use <asp:BalloonPopupExtender> not <Ajax:BalloonPopupExtender> one!
You specifying BalloonPopupControlID="Panel1", but your panel id is Panel2.
Just change it to the correct value and it will work:

force user select from autocomplete

i am beginner for asp.net . I now facing a problem . How can i force a user to select option from ajax control toolkit autocomplete?
Here is my sample code
<cus:cusTextBox ID="txtCMemberID" runat="server" Action="Edit"
CssClass="inputTextM" OnTextChanged="txtCMemberID_TextChanged"
AutoPostBack="True"></cus:cusTextBox>
<asp:AutoCompleteExtender ID="AutoCompleteExtender2" runat="server"
ServicePath="~/Module/Common/autoComplete/acLewreMember.asmx"
MinimumPrefixLength="1" ServiceMethod="GetSuggestedStrings"
TargetControlID="txtCMemberID" CompletionInterval="10"
CompletionSetCount="3" EnableCaching="true"
CompletionListCssClass="completionListElement"
CompletionListItemCssClass="listItem"
CompletionListHighlightedItemCssClass="highlightedListItem"
FirstRowSelected="True"
ShowOnlyCurrentWordInCompletionListItem="True">
</asp:AutoCompleteExtender>
As you see the textbox is a custom control. Is that any way to force user to select option from autocomplete?Please provide me a sample code also. thanks
ASP.NET includes a useful feature called a validator.
<asp:TextBox ID="TextBox2" ValidationGroup="Group2" runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ErrorMessage="*Required" ValidationGroup="Group2"
ControlToValidate="TextBox2" runat="server" />
<asp:Button ID="Button2" Text="Validate Group2"
ValidationGroup="Group2" runat="server" />
Here is the resource link for msdn: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.requiredfieldvalidator.aspx
I'm not sure how these work with custom controls as I'm relatively new at asp. They also have a custom validator which might be more suited for your purposes, but like I said. I don't know exactly.
Note: If the client is using an old browser this won't work, so you also want to check on the server that this field isn't empty by using:
if (Page.IsValid)
{
//stuff to do in your event handler
}

AJAX Control Toolkit MultiHandleSlider readOnly handle

I have a question about AJAX MultiHandleSliderExtender. Code is following:
<form runat="server" id="myForm">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" CombineScripts="false" />
<asp:TextBox ID="strMinModTB" runat="server" Style="display:none;" Text="80" />
<asp:TextBox ID="strCurModTB" runat="server" Style="display:none;" Text="100" />
<asp:TextBox ID="strMaxModTB" runat="server" Style="display:none;" Text="160" />
<asp:TextBox ID="strSlider" runat="server" Style="display:none;" />
<asp:MultiHandleSliderExtender ID="strModMultiSlider" runat="server"
BehaviorID="strModMultiSlider"
TargetControlID="strSlider"
Minimum="0"
Maximum="300"
Length="600"
EnableHandleAnimation="true"
EnableKeyboard="false"
EnableMouseWheel="false"
ShowInnerRail="true"
ShowHandleDragStyle="true"
ShowHandleHoverStyle="true">
<MultiHandleSliderTargets>
<asp:MultiHandleSliderTarget ControlID="strMinModTB" />
<asp:MultiHandleSliderTarget ControlID="strCurModTB" />
<asp:MultiHandleSliderTarget ControlID="strMaxModTB" />
</MultiHandleSliderTargets>
</asp:MultiHandleSliderExtender>
<asp:Label ID="sliderLabel" runat="server" Visible="true"></asp:Label>
</form>
Now what I want to do is to lock positions of outter handles and allow only the middle one to be dragged in range from the left hanle to the right one thus changing the value in asp:Label (ID="sliderLabel").
I've tried readOnly="true" attribute on TextBoxes but with no result. There is also IsReadOnly Extender property but that blocks all handles.
Also when I add the BoundControlID property (containing ID of label) to the Extender it stops working (all handles on 0 position and I cannot drag them)
Is there a way around this or am I missing something?
Thank you for replies :)
You don't need a BoundControlID for the MHSE do you?
Also, could you not add a class to each Handle and then fix the outer handles positions using CSS?
See below for code example.
ASP Code
<asp:MultiHandleSliderExtender ID="strModMultiSlider" runat="server"
BehaviorID="strModMultiSlider" TargetControlID="strSlider"
Minimum="0" Maximum="300" Length="600"
EnableHandleAnimation="true" EnableKeyboard="false"
EnableMouseWheel="false" ShowInnerRail="true"
ShowHandleDragStyle="true" ShowHandleHoverStyle="true">
<MultiHandleSliderTargets>
<asp:MultiHandleSliderTarget ControlID="strMinModTB" HandleCssClass="handle_outer"/>
<asp:MultiHandleSliderTarget ControlID="strCurModTB" HandleCssClass="handle_inner" />
<asp:MultiHandleSliderTarget ControlID="strMaxModTB" HandleCssClass="handle_outer"/>
</MultiHandleSliderTargets>
</asp:MultiHandleSliderExtender>
CSS Code
.handle_outer
{
//Code to Fix Handle in Place
}
.handle_inner
{
}

asp:DataList control with asp:LinkButton inside - something's weird

I'm working through examples in a book trying to learn ASP.NET, and I've stumbled on something strange in there. First of all, if I type it as it's written in the book, VS gives me errors. This is the code as it's written in the book:
<asp:DataList ID="employeesList" runat="server">
<ItemTemplate>
<asp:Literal ID="extraDetailsLiteral" runat="server" EnableViewState="false" />
Name: <strong><%#Eval("Name") %></strong><br />
Username: <strong><%#Eval("Username") %></strong><br />
<asp:LinkButton ID="detailsButton" runat="server" Text=<%#"View more details about " + Eval("Name")%>
CommandName="MoreDetailsPlease"
CommandArgument=<%#Eval("EmployeeID")%> />
</ItemTemplate>
<SeparatorTemplate>
<hr />
</SeparatorTemplate>
</asp:DataList>
So, I've plucked at it for a while, and came up with this solution which actually compiles:
<asp:DataList ID="employeesList" runat="server" onitemcommand="employeesList_ItemCommand">
<ItemTemplate>
<asp:Literal ID="extraDetailsLiteral" runat="server" EnableViewState="false" />
Name: <strong><%#Eval("Name") %></strong><br />
Username: <strong><%#Eval("Username") %></strong><br />
<asp:LinkButton ID="detailsButton" runat="server" Text='View more details about <%# Eval("Name") %>'
CommandName="MoreDetailsPlease" CommandArgument='<%Eval("EmployeeID") %>' />
</ItemTemplate>
<SeparatorTemplate>
<hr />
</SeparatorTemplate>
</asp:DataList>
Notice that I've also added the OnItemCommand in the asp:DataList tag, so now I'm able to fire the event as expected.
However, results in the browser isn't what I expect; the Name and Username listed in strong text show just fine, but the Literal control that should show extra details (the EmployeeID field) and the Name field inside the LinkButton won't show their values in the page:
not showing as expected http://lh6.ggpht.com/_x84bQLYH57A/SgxzygartcI/AAAAAAAAAIY/nhT-6RUJa6o/s144/EmployeeDirectory_notshowing.jpg
It should say "EmployeeID: 1" and "View more details about Zak Ruvalcaba"
I guess it's the Eval function that's not working when inside another control, can anyone help me out?
Change the LinkButton as :
<asp:LinkButton ID="detailsButton" runat="server"
Text='<%# Eval("Name", "View more details about {0}") %>'
CommandName="MoreDetailsPlease"
CommandArgument='<%# Eval("EmployeeID") %>' />
Sorry I confused the order of parameters. I updated my answer. Format must be the second parameter.
You can view another question I posted yesterday concerning something eerily similar here:
Need help with Eval inside DataList
I do believe Canavar actually gave the correct answer, however.

Resources