Setting An Asptextbox To Read Only From The Code Behind
Apr 27, 2010
I need to change the readonly property of a asptextbox from the code behind based on certain conditions.
I know how to run a function when the page loads, but I don't know how to reference the form fields to change the readonly property.
Can anyone point me in the right direction?
View 2 Replies
Similar Messages:
Feb 11, 2010
I would like to set a value:
[code]....
...where [HERE] is the placeholder for my value, from my code behind in ASP.NET before the page is rendered. I generate a guid, and I need that apart of the script on the page.
View 2 Replies
Nov 22, 2010
I have an asp.net web appilcation created in .net 2.0 that is supposed to read and display the app settings from remote web.config (accessible from a shared location). Is there a better way(like reading from the application's web.config ) to read the app
View 5 Replies
Apr 13, 2010
i have an email field, which can't be null and needs to be valid. all that is working fine through my ascx file.
however, i am also checking if that email already exists, and i want to use the rquiredFieldValidator to show the message, and set the page as invalid.
i've tried the following:
valEmail.IsValid = False
valEmail.Text = "xxx"
the xxx never shows :(
but it does nto seem to work.
the validator itself looks like this:
<b>Email:</b> <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
View 6 Replies
Oct 27, 2010
how do i set a CSS attribute programaticaly?
i guess it'0s in the controler?
what i need to do is set a diferent background image to diferent pages, what is the correct way to do it?
View 10 Replies
Jan 8, 2010
I'm more familiar with ASP.NET and not code behind.
how do I read the hidden "code" field in a code behind page using c#?
<html>
<body>
<form id="test" method=""post"" action="processing.aspx")
<input type="hidden" name="code" value="abcdefg">
<input type="submit" value="Submit">
</form>
</body>
</html>
View 2 Replies
Jan 6, 2011
On the RowDataBound event of a gridview I am setting the name of the HtmlInputRadioButton inside the GridViewRow. The problem is that asp.net automatically makes the name unique therefore ungrouping the radio buttons.
Is there a way that I disable this?
Edit - Here's how I am setting the name:
[code]....
Due to the numbers "106" and "107" in the name of the respective radiobuttons it ungroups them.
View 3 Replies
Feb 18, 2011
I have the following code to playback video clips.. we are getting to the point where i need to get this setup and populated from our table.. i already have the data i need to put into the needed parameters, but cant figure it out.. i have tried to add runat="server" and add an ID to the parameters i need to control, but when the page loads, the video window is displayed, but no video is available. and at the moment i have the video hard coded to test, but will need to replace that with video links stored in the table.. what am i missing or doing wrong?
[Code]....
View 4 Replies
Jun 15, 2010
I'm trying to dynamically create a grid view in C#, the grid will have two columns, one of which is a hyperlink field.Now i've noticed when creating the grid view statically in aspx, the DataNavigateUrlFields property accepts a single string as it's value (the field in the data source with the URL in).
When creating it in code, the very same property is a string[] array, rather than a single string, and is expecting multiple fields which combine together to make the URL (if I've understood MSDN correctly), but what if I just want a single field for the URL?
Why does aspx let me do this, but the C# not?
Here's my code:
Name.HeaderText = "Exercise"; Name.DataField = "Name"; Link.HeaderText = "More Info"; Link.DataTextField = "Link"; Link.DataNavigateUrlFields = "Link";
The code above does NOT compile, I got the following error:
Error 2 Cannot implicitly convert type 'string' to 'string[]' This is regarding the last line.
Here is the aspx code, which it's fine with:
<asp:HyperLinkField HeaderText="More Info" DataTextField="Link" DataNavigateUrlFields="Link" target="_blank" />
Does anyone know how I can dynamically create a hypertext field for a grid view, where it only takes a signle field from the data source as the URL?
View 3 Replies
Apr 30, 2010
I want to use the setting stored in the web.config file in my vb code, but don't know how to reference them.
More specifically I want to access the Host name, username and password in the smtp settings to send an email. My web.config is
[code].....
View 11 Replies
Feb 27, 2011
Is there any way to set default setting to the printer through the code , so that i can imagine union and one layout for all users.
View 1 Replies
Mar 3, 2011
I am trying to set up my first custom validator in VS 2010 VB. I want it to use a Sub or Function that is in my code-behind. I have searched the WEB but the instructions and examples that I have found do not show me how to use code-behind.
The main problem that I am running into is that I can not find a way to connect the validator to a sub that preforms the validation check.
View 3 Replies
Sep 16, 2014
I created an image button in my header template. When clicked, it calls the Sorting method. When I change the image url in code behind, it does not render. By setting a break point, I can see the property being updated, but I assume it is getting overridden by the default I set in the HTML page.
Code:
<HeaderTemplate>
<span>Claim Id</span>
<asp:ImageButton ID="btnClaimIdSort" runat="server" ImageUrl="~/Styles/UpArrow.ico" OnClick="Sorting" ToolTip="ClaimId" />
</HeaderTemplate>
Code:
protected void Sorting(object sender, EventArgs e)
{
var sortButton = (ImageButton)sender;
// parse new sort
var newField = sortButton.ToolTip;
// parse existing sort
var existingSortArgs = this.ClaimSort.Split(' ')
[code].....
View 2 Replies
Nov 10, 2010
I have a master page (Site.master) with a navigation menu linked to a datasource (Master.sitemap). I have a nested master page that has another navigation menu. For any item clicked in this nested navigation menu, I want a particular menu item in the Site.master navigation menu to be selected.
Here's my Site.master menu:
[Code]....
In my Site.master.cs I have this:
[Code]....
In the nested master page, Products.master I have this:
[Code]....
In the Products.master.cs file I try to change the selected item.
[Code]....
The master navigation and products navigation menus work just fine by themselves. But when I've tried to set the selected item of the master menu in the Page_Load above, I can't seem to access it. What I've found in trying to do this is the NavigationMenu seems to be uninitialized. The menu Items list is empty. What am I missing here? Why are there no menuItems in the Master.NavigationMenu control?
View 2 Replies
Oct 16, 2010
I have some pages that need user to sign in. If not, I need to redirect user to signin page. I know this can be done by using some code like"<system.web><authorization><deny users="?"/></authorization></system.web>" in web.config.
But can I just write some code to do the same function?
like in page load method, I can check whether user is sign in, if user is not signed in yet, how can I redirect user to the login page by using code? and how can I stop sending the content of the page to user?
View 3 Replies
Jun 10, 2010
I would like to be able to set the EmptyDataText property using code-behind. I have created a custom GridView control called PagingGridView. Here is the definition:
public class PagingGridView : GridView {
}
In my ASPX page, I would created a new GridView definition by doing this:
<cc:PagingGridView id="MyGrid" runat="server" ><cc:/PagingGridView>
When I databind the control, I would like my custom control to automatically detect an empty data source and build a table with all the header columns and a row containing the empty data text. The rendered code for the empty data source would be like:
<table>
<tr>
<td>Col1</td><td>Col2</td>
</tr>
<tr>
<td colspan="2">No Records to display</td>
</tr>
</table>
My initial thought was to override the EmptyDataText property but I could not get that to work.
View 3 Replies
Jan 20, 2010
what I am trying to do is add a method to my gridview's sorting event to add a class to the column being sorted so the user can know if the data is being sorted ascending or descending and on what column. I am currently trying to do it through a switch statement on the sort expression to determine what column it's coming from but I am unaware of how to set the css class.
View 1 Replies
Jun 2, 2010
what is the result of setting the current thread's culture code?
I understand if I use the resource file it will pull label's/strings from the .resx file.
What else? Will it effect my date/money formatting also?
View 3 Replies
Feb 5, 2010
How can I call onblur event or calculate javascript function in the textbox when I setting values in the textbox in code behind??
<asp:TextBox id="txtQuantity" onblur="calculate(this.id);" Columns="6" Rows="1" TextMode="SingleLine" MaxLength="10" CssClass="xTextBox" runat="server"/>
View 2 Replies
Apr 19, 2010
I'm using user controls as web parts in an asp.net application. I have skinned the webparts by adding .PartTitleStyle (etc) to my css. I'd now like to let the user select from a list in an editor part to choose the style for the web part.I'm able to change the title for the webpart, but can't seem to figure out how to change the css to use .PartTitleStyleCustom instead of the default, even trying to set the wp.BackColor seems to have no effect. Here is the code I have so far in the page load event of my user control:
[Code]....
[Code]....
View 1 Replies
Feb 10, 2011
I have a textbox and i want the user to be able to submit a youtube embed code.
Is this possible without setting 'ValidateRequest' to false?
View 2 Replies
Dec 6, 2010
i open a sqldatasource for binding on listview.
I would like also to read a field on first record for print it.
How can i access to my sqldatasource from code behind ?
View 1 Replies
Mar 8, 2011
<sessionState timeout="1440"></sessionState>
how can i read value of timeout from web.config to c# code
View 2 Replies
Mar 3, 2011
Solution: I end up creatting a WCF that accepts a get/post request, then place JQuery within the html page that retrieves the value and hands it off to the web service
I have a html page like below where I will be doing posting to a web site for registrations and my credentials are not suppose to show on the client side.
My question is how/what is the best way of reading the values from code behind or web service or any other way ?
<FORM NAME="web_form" ACTION="https://website.com/registration.php" METHOD="POST">
<TABLE WIDTH=961 BORDER=0 CELLPADDING=2 CELLSPACING=0>
<TR>
<TH WIDTH=380>
<P ALIGN=RIGHT><i>Encrypted Username:</i>
</P>
</TH>
<TD WIDTH=573>
<P><A NAME="username"></A><INPUT TYPE=TEXT NAME="username" VALUE="HOW TO GET VALUE???" SIZE=20 STYLE="width: 1.69in; height: 0.23in"></P>
</TD>
</TR>
<TR>
View 4 Replies
Jun 20, 2010
I want to be able to read data from a database through ASP.net code VB Code into an array and then pass it to an array in Javascript. How would I go about that?
View 8 Replies