AutoSuggest Using jquery.tokeninput.js in Repeater Contol in asp.net c# - c#

I have taken input textbox in Repeater ItemTemplate and on page load i call a function which fires tokeninput js file
on page load autosuggest works for only first textbox in repeater control .How to make it functional for all textboxes in repeater control.
Any help is much appriciated!

Instead of using selector by id
$("#my-text-input").tokenInput("/url/to/your/script/");
use selector by css class
$(".myclass").tokenInput("/url/to/your/script/");
and assign it to all required texboxes using
CssClass="myclass"

Related

How can I print repeater data in asp.net?

How can I print Repeater data?
I am having a Search page which makes search query according to the input given and populate the repeater. Now I want to print this result displayed in the repeater. How can I do that on the onClick button event of a "Print" asp:Button?
If you want to provide search capability, follow below steps-
If you are filling repeater on PageLoad with whole data, remember to prevent your repeater binding always on PageLoad using IsPostBack property.
Now on Click event get the filtered data, and bind it with repeater.
Hope this will solve your problem, If need any help please update your question with code.
Thanks.

Removing the view state of perticular repeater control

We have a requirement where i need to delete the view state of particular repeater from Jquery/javascript.
Example
I have two repeater repeater 1 and repeater 2
onclientclick of button i want remove all the data of the repeater 1 along with the particular repeater viewstate.
i am able remove the data of the repeater using
$(tableid).remove();
but view state of the repeater still exist. I can not disable the view state of the repeater otherwise few functionality will not work.
You can't do that.
In this case, don't use a repeater. Create your own version of the repeater using js/jquery and html markup. You can maintain the state and load data trough callbacks using ajax.

asp FileUpload in content page not working due to updatepanel in master page

I have a master page where an update panel contains the main placeholder of the content pages.
Inside one of the content pages I need to disable the update panel in any way since I have a form with asp:fileupload control that is always returning null due to the update panel.
How can I overcome this issue?
Place your fileuploader and submit button in another update panel and add a post back trigger for this update panel.
On page load of content page, try to get the update panel of master page using FindControl method and then attach your file upload as a post pack trigger to it dynamically.
That may work
I've got a bad news for you.!
Have a look at this
http://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx
The following ASP.NET controls are not compatible with partial-page updates, and are therefore not supported inside an UpdatePanel control:
TreeView and Menu controls.
Web Parts controls. For more information, see ASP.NET Web Parts Controls.
FileUpload controls when they are used to upload files as part of an asynchronous postback.
GridView and DetailsView controls when their EnableSortingAndPagingCallbacks property is set to true. The default is false.
Login, PasswordRecovery, ChangePassword, and CreateUserWizard controls
whose contents have not been converted to editable templates.
The Substitution control.
Validation controls, which includes the BaseCompareValidator, BaseValidator, CompareValidator, CustomValidator, RangeValidator, RegularExpressionValidator, RequiredFieldValidator, and ValidationSummary control.
Solution :
You may want to use Ajax FileUpload using Jquery in place of update Panel. Remember, Open source is always a better option. :)

Dynamic Drop Down List ASP.net

How can I create a dynamic drop down list without using AutoPostBack. I ask because I just want to change the value of what the second drop down list displays and then the user clicks a button and it submits. But If I use AutoPostBack then it postbacks to page and runs code that shouldn't be run until that final box has been selected. (I use Postback in the other part of my program so using !IsPostBack isnt a option.) I looked at Javascript but ASP generates all of its controls names at runtime. What can I do? I have looked at the Ajax CascadingDropDown control but my problem with that is it contained in a XML file or a Database, I need this to be contained inside my Page. Any Ideas?
You can use the CascadingDropDown control from the AJAX Control Toolkit
Maybe this example will help? It's part of the ASP.NET AJAX Control Toolkit available here.
You can use AJAX to get the values for the second drop down list, based on the selected value of the first. Add a onchange event handler on the client-side to the first drop down list that makes the AJAX call and fills the second on success.

How do I add response from TextBox? c#

I have created my own control which contains TextBox control as a child control. this textbox has autopostback set on. when the postback is called I dont get any text in request.querrystring.
where should I specify text entered into texbox will be send to response ? or is there any easier way of sending this information? I want to have the entered text once again in textbox after postback.
thank you
For dynamically created controls, you need to create them and add them to the control tree in the Page_Init() event; Page_Load() is too late, and Page_PreRender() is way too late.
Once in the control tree, the runtime will restore the state of the control for you after a postback. You can access the contents of the control using myTextBox.Text -- you don't need to use Request.QueryString
For a control that only contains a TextBox, things would be much easier if you used a user control rather than an INamingContainer. That way, you could just use <asp:TextBox> in your .ascx markup.
A custom control? Any posted control like this loads its data in LoadPostData method. You can override this in your custom control class, and access the value from teh control via:
var text = postDataCollection[textboxID];
The textbox within your custom control has to have an ID.
If you are talking something else, let me know the specifics.
Thanks.
(TextBox)Control.FindControl("control id")
get dynamic control's value in postback , Request.Form("control client id")

Categories

Resources