C# - Hide Text In A ASPX Page That Is Tied To A Textbox?

Sep 8, 2010

So there is a a table and a text box in one of the cells

<td>
<asp:TextBox ID="tbSomeTextBox" Columns="5" runat="server"> %
</td>

This textbox gets shown if a certain selection is made in a drop down. The problem is that I would like the "%" character to also be hidden or shown with the textbox.

I have tried putting the whole textbox control inside a DIVand in my JQuery hiding the DIV at the same time I hid the textbox.

<td>
<div id="divSomeDIV"><asp:TextBox ID="tbSomeTextBox" Columns="5" runat="server"> % </div
</td>

But I get an error in my java script that id="divSomeDIV" doesn't exist in the current context.

$("#<%=divSomeDiv.ClientID%>").hide();

Wrapping that single character in a asp:Label seems like overkill.

View 3 Replies


Similar Messages:

C# - Getting No Postback On Button? Tied It To Javascript Which Is Tied To A Div

Mar 30, 2011

Im getting no postback on my button? I have it tied to Javascript like so:

<script type="text/javascript">
function confirm_delete()
{
if (confirm("Are you sure you want to delete this comment?")==true)
return true;
else
return false;
}
</script>
<p>
<asp:Button ID="btn" OnClientClick="if(confirm_delete()){/* post back*/}else{return false;};" OnClick="btnDelete_Click" runat="server" CssClass="Btn" Text="delete"/>

But when I click ok on confirm no postback is initiated, its initiated if I click the button manually?

private void PopulateWallPosts(string userId)
{
using (OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite2; User=root; Password=commando;"))
{
cn.Open();
using (OdbcCommand cmd = new OdbcCommand("SELECT idWallPosting, wp.WallPostings, p.PicturePath FROM WallPosting wp LEFT JOIN User u ON u.UserID = wp.UserID LEFT JOIN Pictures p ON p.UserID = u.UserID WHERE wp.UserID=" + userId + " ORDER BY idWallPosting DESC", cn))
{
//("SELECT wp.WallPostings, p.PicturePath FROM WallPosting wp LEFT JOIN [User] u ON u.UserID = wp.UserID LEFT JOIN Pictures p ON p.UserID = u.UserID WHERE UserID=" + userId + " ORDER BY idWallPosting DESC", cn))
using (OdbcDataReader reader = cmd.ExecuteReader())
{
test1.Controls.Clear();
while (reader.Read())
{
System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
div.Attributes["class"] = "test";
div.ID = String.Format("{0}", reader.GetString(0));
// this line is responsible, problem here and my sqlsntax, im trying to set the SELECT idWallPosting for the div ID
Image img = new Image();
img.ImageUrl = String.Format("{0}", reader.GetString(2));
img.AlternateText = "Test image";
div.Controls.Add(img);
div.Controls.Add(ParseControl(String.Format(" " + "{0}", reader.GetString(1))));
div.Attributes.Add("onclick", "return confirm_delete();");
div.Style["clear"] = "both";
test1.Controls.Add(div);
}
}
}
}
}
protected void btnDelete_Click(object sender, EventArgs e)
{
string id = "ctl00_ContentPlaceHolder1_ContentPlaceHolder2_26";
string[] idFragments = id.Split('_');
id = idFragments[idFragments.Length - 1];
//serverside code if confirm was pressed.
using (OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite2; User=root; Password=commando;"))
{
cn.Open();
using (OdbcCommand cmd = new OdbcCommand("DELETE FROM WallPosting WHERE idWallPosting = " + id + ")", cn))
{
cmd.ExecuteNonQuery();
}
}
//PopulateWallPosts();
}

EDIT: Tryed this,

function confirm_delete()
{
if (confirm("Are you sure you want to delete this comment?")==true)
return true;
else
return false;
}
</script>
<p>
<asp:Button ID="btn" OnClientClick="return confirm_delete();" OnClick="btnDelete_Click" runat="server" CssClass="Btn" Text="delete"/>

still no postback

View 2 Replies

Web Forms :: How To Hide The Text Inside The Textbox

Aug 10, 2010

i have a textbox and a checkbox. when the user checks the checbox the text inside the textbox should not be visible to the other user.

how can i achieve this?

View 6 Replies

Is It Possible To Hide Windows Taskbar During Page Load Of An Aspx Page

Dec 23, 2010

is it possible to hide windows taskbar during page load of an aspx page?

View 3 Replies

Configuration :: How To Hide ASPX Page Name

Aug 6, 2010

I want to know that how can i hide aspx page in URL just from main page. Like when i go to my site http://mysite.com it shows me an aspx page at the end. like

http://mysite.com/Home.aspx

How can i hide that Home.aspx from URL

I need to hide it from main page only

View 7 Replies

Web Forms :: How To Hide The Default.aspx Page

Feb 16, 2010

How can I hide the Default.aspx page from within a folder[URL] It does not show the /Default.aspx

but when validating any empty textbox then it shows as follow

[Code]....

View 3 Replies

How To Hide Property Of Custom Control In Aspx Page

Feb 8, 2010

I'm writing ASP.NET custom control, and I want it to have a few properties which should be visible only from code behind during run-time - I mean, these properties should not be visible both in a designer and in a aspx code of page containing this control. I've tried to use following attributes:

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Browsable(false)]
public List<Item> SomeData
{
...
}

but unfortunately this property is still visible in an Intellisense combobox when editing aspx page. Is it possible to hide this property everywhere besides server-side code ?

View 2 Replies

How To Hide A Content Place Holder In .aspx Page

Jul 1, 2010

My master page has 3 content place holders:

1. left side bar

2. middle content area

3. right side bar

So it looks like:

<div id="left"></div>
<div id="content"></div>
<div id="right"></div>

On a particular view page (.aspx) that inherits the master page, I want to now show #3 (right side bar).

So I don't want the to be rendered at all.

View 3 Replies

Web Forms :: Toggle Full Screen Feature In Free Text Box Rich Text Control On Aspx Page

Jan 25, 2011

I am using FTB on my aspx page. is there any way I can have Toggle Full screen feature in FTB, is this feature availble in FTB? it is available on TinyMCE, but I don't want to switch to TinyMCE since I am already using FTB in most of the pages in my application.

View 1 Replies

Web Forms :: Copy One Textbox Text Into Other Textbox In Other Page

Feb 7, 2013

I have 2 page index.aspx page and search.aspx

in index.aspx I have 1 textbox==txtIndex and 1 button ==btnIndex

and in search.aspx page I have 1 TB==txtsearch  and 1Button==btnsearch

I want when users enter text into TxtIndex that is in Index.aspx page and click on btnIndex

It go to Search.aspx and copy txtIndex.Text into TxtSearch

View 1 Replies

Web Forms :: Have Two User Control Page - How To Retrieve Text Box And Drop Down Value In Both Page In Aspx...

Oct 18, 2010

i have two user control page how to retrive text box and drop down value in both page in our aspx page

View 2 Replies

Web Forms :: Passing Text Box Value From Aspx.cs Page To SelectParameters In Page

Sep 5, 2010

I would like to take a value from a text box and pass it as a search parameter to my database. I get the value from my code behind page as follows: protected void btn_click(Object sender, ImageClickEventArgs e)

View 2 Replies

Web Forms :: How To Feed A Value Selected In An HTML Page Into A Textbox Of A Subsequent Aspx Page

Sep 22, 2010

I want to be abel to allow a user to input a users loginID into an html page, then when clicking a login submit button, load an aspx page (vb) and feed the text that was inputed into the login Input Text field into the aspx pagees login textbox.

View 3 Replies

Web Forms :: How To Get Focus In A Textbox In Aspx Page That Contain Master Page

Jan 6, 2011

in my webpage setfocus is working ,in that web page contain the master page am trying like that one Master page

Page.Form.Defaultfocus=txtboxid.ClientId;
or
Page.Form.DefaultFocus=txtboxid.UniquId; how to do in master page

but it is not working

View 7 Replies

Function To Display Text On Aspx Page?

Mar 21, 2011

i have iframe:

<iframe src="www.google.com">

i want to generate the src dynamically can i do;

<iframe src="<%=urlname()">
OR
<iframe src="<%urlname()">
OR
<iframe src="<%=EVAL(urlname())">
AND
IS URLNAME() A FUNCTION OR SUBPROC?

View 3 Replies

Web Forms :: Text Editor In .aspx Page?

May 10, 2010

I Want to apply the text editor in my aspx page . i search some open source editor .but there is not provioded sufficient information how to implement..if any text editor in open source plz suggest me which is easy to use .. and provide me full information for installation

View 7 Replies

How To Auto Hide Label After 10 Sec And After Label Hide Redirect To The ~/Default.aspx

Jan 15, 2011

I have a label and button on label in my asp.net webform ....i want when i click on button then label1 will be visible with text "Success" and then it will hide automatically after some time say 10 seconds ,,,I M using asp.net (VB)How to auto hide label after 10 sec and after label hide redirect to the ~/Default.aspx ?

View 1 Replies

Configuration :: Aspx Page Displays As Plain Text?

Mar 30, 2011

i have win 7 with internet explorer 8.

i have a Web application project in the VS2010,

when i execute it using local port auto-asign port, the aspx page shows ok on the internet explorer.

when i run the same project from the IIS (Browsing the aspx page from the iis), only the controls text is displays without the controls (colors and menus .. ) - although the source view shows that the tags exists.

View 2 Replies

Want C# ASPX Page To Produce Plain Text Rather Than HTML

Jul 29, 2010

I have a C# project in Visual Studio that produces an aspx page. The code I am editing is in default.asp.cs. When I build the project a file default.aspx is produced. This file looks something like this:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CSRValidationConnector._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" [URL]-transitional.dtd">
<html xmlns="[URL] >
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>

When I make my web request most of this page comes back. But I want the page to return only plain text and not any of this HTML. How do I configure things so that nothing is returned except what I add via Response.Write calls in default.aspx.cs?

View 2 Replies

Web Forms :: Send TextBox Text Value From Current Page To Previous Page?

Dec 15, 2012

i want to see my textbox value when i click on previous button in another page

then display my 1st page enter textbox value.

View 1 Replies

How To Sum Column And Show The Total In Textbox In Aspx.vb Page

Sep 22, 2010

i have 50 column and i want to sum one by one , the total will show in the textbox that mean total of each column will show in each textbox.

View 3 Replies

AJAX :: Show/hide The Text Box Depending On The Text Of The Selected Item In The Combo Box?

Nov 13, 2010

I have a .net 3.5 web form with an ajax combo box and a text box inside it. The bombo box is bound to a SqlDataSource.

My requirement is to show/hide the text box depending on the text of the selected item in the combo box. If a particular string, say 'xyz', appears in the text of the selected item, the I will make the text box invisible. I enabled the AutoPostback, made the text box disappear in the SelectedIndexChanged event, and everything worked fine.

However, when users enter their own texts (which are not in the list items), I am unable to show / hide the text box. I've tried the TextChanged event but nothing happens. It seems the event is not trigger after I enter a new text and locate the focus to other place.

is there a way to prevent the user ented text from being inserted into the bombo box?

View 3 Replies

C# - How To Assign Text To A File Upload Control On An Aspx Page

Oct 29, 2010

My file upload control is in page for editing records so i want to retrieve the path stored in database and assign it file upload control. i have written select query to get data but i do not know how to display the stored file path in file upload control.

View 1 Replies

ADO.NET :: Insert Data From Text Boxes On ASPX Page Into SQL Database Using VB?

Oct 4, 2010

This is what I have come up with, but when I run it I get the following error (I decided to just try to use a simplified table just to get an understanding of the basic concepts):

Partial Class label_form
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
' Declaring variables

[Code]....

View 3 Replies

Web Forms :: How To Open A Text/pdf/mp3 File On Hyperlink Click From A Aspx Page

Jan 29, 2010

i have a fileupload control which i use to upload file to the server. after the upload is successful i enable a hyperlink with the name of the uploaded file.

i want the user to be able to view this file in the browser after the file has been uploaded.

i did try assigning the navigateurl for the hyperlink = HttpContext.Current.Request.MapPath(".") + "\folder1\" + fileName;

which dint work. all uploaded files are being stored in a folder inside my solution directory on the server.

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved