I'm creating a small, private social networking site. I wanted to add 'emoticons' by filtering text such as and replacing it with an image tag. That's easy enough with stringname.Replace() but what i'm wondering is, is there a way to add some sort of a 'filter' that will automatically do that replacement for me on ANY string post back so i don't have to add the replace code to every page?
I have a list box with data coming from the database. Above the list box I have a text box. If the user enters some text in the text box,then the data in the list box should be filtered as per the content entered in the textbox. In my page, i have about 7-8 such similar textboxes and listboxes. So I want to implement a common function which can be used for all the text boxes in the page. I tried to achieve this in textchanged event and javascript but sometimes not working. Is there any other simple way except javascript? Is it efficient to use java script in this scenario? Need your valuable inputs.
I have seen in so many sites on the home page there is a search option and after searching any word of the website it displays and in w3schools it navates to goolge with his reference.
How to write a code for the same and which control we should use.
URL....I used this post to filter and search drop down list but if i have autopostback=true it doesn't work. i want to pass the selected value to diffect sub to bind another dropdownlist.
I have a Datagrid control which is populated with data from an Access database when the page loads - a simple 'Select *' command. This page also contains a text box and a button, the idea being that the user can then filter the data by entering a value in the text box and clicking on the button to pass the new parameter to the datasource.
However, I cannot get this to work, I know it has something to do with 'IsPostback', but I am at a loss. I have tried variations of the following in the code behind page but to no avail.
I work for a company that has many sites. Each site requires a login at some point. We have a single Accounts database that all of the sites hit.One of the requirements for the login system is that if we login on one site, we should automatically be logged in elsewhere.
The way it works right now is that on page load (or init, forget which) at any of our sites (let's say site1.com), it redirects to a "master" site (let's say sitemaster.com). On sitemaster.com there is a web service which checks to see if a cookie exists on sitemaster.com for that user. If it does, it redirects back and lets site1.com know that the user has already logged in (site1.com then creates a cookie for site1.com so we don't have to redirect to sitemaster.com in the future). If the user is not logged in at sitemaster.com, site1.com will then ask the user to login and, on submit, it redirects the user to sitemaster.com which logs them in, creates a cookie under sitemaster.com domain, redirects back to site1.com and lets site1.com know that the user is logged in (which then creates the cookie for site1.com).
On logout a similar method is employed.
Is this the best way of handling universal logins, or auto-logins across multiple sites? Is there a better way of doing things?
Some requirements:Most of our sites are in .NET 2.0, but there are plans to update them all to .NET 4.0. We want the best method for this auto-login system so if something requires .NET 4.0, that's ok.
The solution should not require javascript (our current solution requires javascript during the login process).The solution should not require Flash.It's ok to use iframes, as long as javascript is not requred.
We would like to be able to do AJAX logins (using jQuery) without having the site refresh. The current solution, due to the redirects, prevents us from doing that. (eg: Pop up a modal box asking the user to login, and when they do, the modal box disappears and some content is changed, but no site refresh required). This isn't absolutely necessary, but at the very least we should be able to verify a login using AJAX before any redirecting takes place.
I also have some questions related to the best way of re-using the auto-login code across sites (varying from ASP.NET 2.0 Forms to ASP.NET 4.0 MVC, but I'll save that for another question).
I am assuming there is an elegant way to do this, but I do not know what it is. In an application I am working on, I have a lot of ContentResults that return xml. Every action that does return xml runs through the exact same try/catch block and I am repeating myself over and over again - here is an example of what I am talking about:
public ContentResult SomeAction() { try { //some stuff here } catch(Exception ex) { HandleErrorMethod(ex); } return this.Content(someObject.ToXmlString(), contentReturnType); }
This happens 3-4 times in a controller so I figure there is a way I can either paint it with an attribute, or run some sort of method in the global.asax or something like that to prevent repeating myself over and over - not to mention code changes in the future.
I have a web application (done in ASP/C#) that has regex validation on a text box. Initially the regex works perfectly fine. But then I also provide a button click event (clear) that allows the user the clear text box and change their input for a new query. At this point (page post back) the regex takes control and maintains control of the text box so a new query can't be run. Can anyone tell me what to do so that the regex doesn't fire on page postback and allows new input for validation?
I have a button that has an server side event onclick that when triggerd adds javascript code to the onclick event and changes the text value.
On the second click only the javascript code is triggered who changes the text value of the button and sets the client side onclick event to null, while resoponding wiht an return false to counter the postback.
On a real postback of my page the button text value is set back to the latest value given by server side code, it does not keeps its properties set by the javascript client code.
I think this is normal as the button is not posted back or something like that. How could I keep its client side changed properties and let the server side know about it ? Can I modify the viewstate or something similar .... ?
I have a textbox and a button. On page load I select one column from one row and put its value in the textbox. I have a button click method that updates the same column/row with the new value in the same textbox.
The problem i'm having is that when I clear the text in the text box, type in new data and hit submit the new text value is not being saved, it uses the old one.
I put a breakpoint at the end of my button click method and it appears that asp.net is sending the old value of the textbox rather than the new one I put in. I'm totally stumped.
I have two text boxes and one label control. All three controls are in different "td". Now what i want to do is , i am subtacting a value of textbox2 from the value of textbox1 and storing an answer in label control. I have written a code of subtracting values in the text changed event of textbox 2 and i am also getting an answer in label control. But when text changed event fires, it takes some time to execute which i reall dont like. this is why i want to use update panel to reduce that time. how can i use update panel in this kind of situation. i tried but not successded. so please write some code here related to my controls.
I have a form where i want to view all columns from a table.I have a textbox and differeent radio button having values of each column.On click of button.I want to view all the columns as per selected row/rows from value given
In securing actions/controllers, do I have to create a custom filter or use MVC built-in filter?
To use the built-in attribute Authorize() on an action/controller or create a separate class that inherits the ActionFilterAttribute which has a method (OnActionExecuting) to override and do the authentication there?
In my organization we use nested groups. For a particular usage, we have a group (let's assume that the group name "kuku"), and the names of all the nested groups under it contains "kuku" as well.
We may assume that no other group in the LDAP has "kuku" in the name.
I need to create a filter which will return all the users which belong to one of the "kuku"s group.
Obviously, using this filter will bring only the head kukus
(&(&(objectclass=user)(objectclass=person))(memberOf=CN=kuku,cn=...rest of the group DN...))
How can I use wild card to fetch all users which belong to any kuku?
For example: (&(&(objectclass=user)(objectclass=person))(memberOf=CN=.*kuku.*))
I have decorated my base controller with a couple of action filters. They work fine.
One of those filters sets up the request - does things like set the culture based on the domain, etc.
I also have a handful of actions that require authorization using the Authorize attribute.
My problem is that when an user attempts to request a page they are not authorized to access, the authorization filter kicks in and redirects them to a page telling them that they cannot vie the page.
The issue is that the action filters never run so the culture and other request data is never set. This effectively causes language to be wrong in the view and other data to be missing.
I know that authorization filters run first but my question is this: How can I design this such that I can ensure that certain methods are always run before the view is returned, regardless of the authorization.
I'm making a site and throughout the site I haven't been very consistent with the way I get user input on postbacks. For example, say in a button event that takes two strings retrieved from textboxes and adds them together and outputs the string sum in a label:
protected void btnCalculate_Click(object sender, EventArgs e) { string text1 = textBox1.Text; //one way string text2 = Request["textBox2"]; //the other way lblSum.Text = text1+text2; }
I imagine you would want to use Request[""] if the data has been posted to a new page, but for this situation, is one way preferred over another, and why?
I've got a simple ASP.Net form with txtBox and btn.
User click btn, which adds text to an ASP:TextBox in a postback (its adding a known "starter text".
After the postback I'd like the focus to be set to the end of the text in the textbox.
If I call Page.SetFocus(...) or txtBox.Focus() then the txtBox gets focus, but at the beginning of the text - which means if the user starts typing, they'll be in the wrong place.
e.g.
cursor100-01
would like it to be
100-01cursor
I've tried the following in the textbox:
onfocus="alert('focus');this.value = this.value;"
but the "alert" only appears the first two times? Then nothing?
If I click this button it is working OK (it will respond with a PFD file so no HTML is sent back to the browser), but if I click another button on the page (which makes a full postback) the LinkButtonPrint will not have the inner content, it will be rendered like this:
<a href="javascript:__doPostBack('ctl00$LinkButtonPrint','')" id="ctl00_LinkButtonPrint" onclick="StartLoadTracking(this, 'Loading...');"></a> If I remove the LinkButtonPrint.Attributes["onclick"] = ... line from Page_Load everything works fine (except my js function is not called, but that is normal).
What am I missing here?
EDIT This is duplicate of asp.net Link button image not visible after postback.
On clicking updatebutton in gridview i need to check the value which is enter by the user is less then or equal to..How to do thisFor example:-Eidt itemtemplate textbox contain 200.. on clciking update if its any number from 0 to 200 will accept and above 200 will says the value not lessthenor equal to
I have 2 "Updatepanel" controls. Each contains a textbox linked to a "TextBoxWatermarkExtender", and a button. When I click on one of the buttons without to enter any text, all the watermark text disappear on BOTH updatepanel when they should remain visible.
[code]...
How can I avoid the waternmark text to disappear when I click on the button?
i have update panel with some wierd ie 7 issue, when you click a a - z link on the below url, after the async postback the linkbuttons disapear until you mouse over, not sure why this is happening.
On my page: a Button1, a ListView1, a Panel1 and inside Panel1 an ImageButton1In the ListView1_PreRender-Event the property Panel1.Visible = false or Panel1.Visible = true is set.1. After first loading of the Page Panel.Visible = false ist set in ListView1_PreRender.2. After the postback click on Button1 the criteria for the visibility of Panel1 are evaluated, thus setting in the ListView_PreRender Panel.Visible = true.