Saturday, March 31, 2012
Text box Display
I have a text box a button next to it, and then a submit button below
everything so that when the 1st button is pressed, a calendar appears
underneath it.
Becasue the submit button is below all the user input stuff, I want to
make it so that the calendar and the submit buttons are given set
positions on the screen, so that whenever I press the 1st button, my
submit button doesn't get pushed down the screen to make way for the
calendar.
I would've thought Display="Static" would do this, but I get the same
result as using Display="Dynamic". Can anybody help me out with this?
Any help would be really appreciated.
Thanks,
Mike
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!You need to use absolute display but make sure the parent elements are all
setup - positioning elements in pixel offsets is not a very good thing to
do. Static is meant for something else and IE does not even support it.
Jerry
"Mike P" <mrp@.telcoelectronics.co.uk> wrote in message
news:OVZiJ#UmDHA.2772@.TK2MSFTNGP10.phx.gbl...
> I don't understand the Display setting for controls such as text boxes.
> I have a text box a button next to it, and then a submit button below
> everything so that when the 1st button is pressed, a calendar appears
> underneath it.
> Becasue the submit button is below all the user input stuff, I want to
> make it so that the calendar and the submit buttons are given set
> positions on the screen, so that whenever I press the 1st button, my
> submit button doesn't get pushed down the screen to make way for the
> calendar.
> I would've thought Display="Static" would do this, but I get the same
> result as using Display="Dynamic". Can anybody help me out with this?
>
> Any help would be really appreciated.
>
> Thanks,
> Mike
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
Text box text from dataset
i have dataset with the result and i bind it to datagrid
in datagrid i use to display text for hyperlink
<asp:datagrid
'<%# DataBinder.Eval(Container.DataItem, "ForumName") %>'
</asp:datagrid>
now if i have hyperlink some where on page and i need the text of this hyperlink to show the forumname what user has selected.how to do that.the dataset has the result and i want the ForumName from the dataset to hyperlink which is on the page not in datagrid.
Hello,
The code below creates a GridView control that have a hyperlink column which
sends the ID to other page:
Here is the simple code which you can use:
<asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="White"
BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1"
GridLines="None" AutoGenerateColumns="False">
<FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
<RowStyle BackColor="#DEDFDE" ForeColor="Black" />
<PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
<Columns>
<asp:BoundField DataField="CategoryID" />
<asp:HyperLinkField DataNavigateUrlFields="CategoryID"
DataNavigateUrlFormatString="SmallWindow.aspx?id={0}"
DataTextField="CategoryName" NavigateUrl="SmallWindow.aspx" />
<asp:BoundField DataField="Description" />
</Columns>
</asp:GridView>
So, now when you click the CategoryName you will be redirected to SmallWindow.aspx page.
Wednesday, March 28, 2012
Text Box?
Is it possible to display text box that has TextMode set to MultiLine
and Rows to 5 for example and not to show vertical scroll bar
Thanks
Alex
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!This is achieve by the style attribute OVERFLOW
>--Original Message--
>Hi
>Is it possible to display text box that has TextMode set
to MultiLine
>and Rows to 5 for example and not to show vertical scroll
bar
>Thanks
>Alex
>*** Sent via Developersdex http://www.developersdex.com
***
>Don't just participate in USENET...get rewarded for it!
>.
Thanks
acko
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Monday, March 26, 2012
Text Format String - Please help
I need to display a DateTime field in 'mm/dd/yyyy' in a DataGrid.. On
myGrid1 - Properties - Columns - myColumn1 - Text format string:
I tried to put 'mm/dd/yyyy' in there and it displays 'mm/dd/yyyy' in stead
of '04/10/2001'. I know I didn't do it right. Please let me know what's the
correct way to display a 'mm/dd/yyyy' format for a DateTime coulmn.
Thanks.
Eddymake sure ur page Culture is set right
"Eddy Soeparmin" <esoeparmin@.clientprofiles.com> wrote in message
news:udPQR07RDHA.2008@.TK2MSFTNGP11.phx.gbl...
> Hi,
> I need to display a DateTime field in 'mm/dd/yyyy' in a DataGrid.. On
> myGrid1 - Properties - Columns - myColumn1 - Text format string:
> I tried to put 'mm/dd/yyyy' in there and it displays 'mm/dd/yyyy' in stead
> of '04/10/2001'. I know I didn't do it right. Please let me know what's
the
> correct way to display a 'mm/dd/yyyy' format for a DateTime coulmn.
> Thanks.
> Eddy
Hi Vincent,
> make sure ur page Culture is set right
I don't really understand what you mean by that, would you please explain
more specific in detail? I'm very new in this area. Is there something that
I have to do in VS.Net? or IE? Please advice.
Thanks.
"Vincent V" <vincentv@.-n0-5pam-optushome.com.au> wrote in message
news:O6fD6H8RDHA.304@.tk2msftngp13.phx.gbl...
> make sure ur page Culture is set right
> "Eddy Soeparmin" <esoeparmin@.clientprofiles.com> wrote in message
> news:udPQR07RDHA.2008@.TK2MSFTNGP11.phx.gbl...
> > Hi,
> > I need to display a DateTime field in 'mm/dd/yyyy' in a DataGrid.. On
> > myGrid1 - Properties - Columns - myColumn1 - Text format string:
> > I tried to put 'mm/dd/yyyy' in there and it displays 'mm/dd/yyyy' in
stead
> > of '04/10/2001'. I know I didn't do it right. Please let me know what's
> the
> > correct way to display a 'mm/dd/yyyy' format for a DateTime coulmn.
> > Thanks.
> > Eddy
Eddy,
I found myself having this problem the other day and
couldn't find any documentation in the MSDN other than for
numbers. Here is what you need to put in the format
string:
{0:mm/dd/yyyy}
Also,
http://asp.net/ is a really good site for anything related
to ASP .NET or .NET in general. The people in the Forums
there are very helpful and usually can answer my questions
within an hour.
>--Original Message--
>Hi,
>I need to display a DateTime field in 'mm/dd/yyyy' in a
DataGrid.. On
>myGrid1 - Properties - Columns - myColumn1 - Text format
string:
>I tried to put 'mm/dd/yyyy' in there and it
displays 'mm/dd/yyyy' in stead
>of '04/10/2001'. I know I didn't do it right. Please let
me know what's the
>correct way to display a 'mm/dd/yyyy' format for a
DateTime coulmn.
>Thanks.
>Eddy
>
>.
Vincent,
Try using the format "{0:MM/dd/yyyy}". Also, check the Help section within
the DataGrid Property Builder dialog box. It will provide you with more
information about the format modifiers.
Charlie Nilsson [msft]
Visual Studio Update
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
-------
> From: "Eddy Soeparmin" <esoeparmin@.clientprofiles.com>
> Subject: Text Format String - Please help
> Date: Fri, 11 Jul 2003 11:03:09 -0400
> Lines: 14
> X-Priority: 3
> X-MSMail-Priority: Normal
> X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
> Message-ID: <udPQR07RDHA.2008@.TK2MSFTNGP11.phx.gbl>
> Newsgroups: microsoft.public.dotnet.framework.aspnet
> NNTP-Posting-Host: adsl-065-083-137-202.sip.asm.bellsouth.net
65.83.137.202
> Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP11.phx.gbl
> Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:158558
> X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> Hi,
> I need to display a DateTime field in 'mm/dd/yyyy' in a DataGrid.. On
> myGrid1 - Properties - Columns - myColumn1 - Text format string:
> I tried to put 'mm/dd/yyyy' in there and it displays 'mm/dd/yyyy' in stead
> of '04/10/2001'. I know I didn't do it right. Please let me know what's
the
> correct way to display a 'mm/dd/yyyy' format for a DateTime coulmn.
> Thanks.
> Eddy
Thanks Brian, Charlie,
When applying that format, it displays 00/09/1999 instead of 07/09/1999. I
will look at the http://asp.net/ and DataGrid Property Builder dialog box.
Eddy
"Charlie Nilsson [MSFT]" <CharlieNilsson_CUTOUT_@.hotmail.com> wrote in
message news:N6MXH28RDHA.1616@.cpmsftngxa06.phx.gbl...
> Vincent,
> Try using the format "{0:MM/dd/yyyy}". Also, check the Help section
within
> the DataGrid Property Builder dialog box. It will provide you with more
> information about the format modifiers.
> Charlie Nilsson [msft]
> Visual Studio Update
> --
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
> Note: For the benefit of the community-at-large, all responses to this
> message are best directed to the newsgroup/thread from which they
> originated.
> -------
> > From: "Eddy Soeparmin" <esoeparmin@.clientprofiles.com>
> > Subject: Text Format String - Please help
> > Date: Fri, 11 Jul 2003 11:03:09 -0400
> > Lines: 14
> > X-Priority: 3
> > X-MSMail-Priority: Normal
> > X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
> > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
> > Message-ID: <udPQR07RDHA.2008@.TK2MSFTNGP11.phx.gbl>
> > Newsgroups: microsoft.public.dotnet.framework.aspnet
> > NNTP-Posting-Host: adsl-065-083-137-202.sip.asm.bellsouth.net
> 65.83.137.202
> > Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP11.phx.gbl
> > Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.aspnet:158558
> > X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> > Hi,
> > I need to display a DateTime field in 'mm/dd/yyyy' in a DataGrid.. On
> > myGrid1 - Properties - Columns - myColumn1 - Text format string:
> > I tried to put 'mm/dd/yyyy' in there and it displays 'mm/dd/yyyy' in
stead
> > of '04/10/2001'. I know I didn't do it right. Please let me know what's
> the
> > correct way to display a 'mm/dd/yyyy' format for a DateTime coulmn.
> > Thanks.
> > Eddy
Hi Brian,
I finally get it to work now. Earlier I got 00/09/1999 instead of 07/09/1999
because I'm using {0:mm/dd/yyyy}. It's case sensitive, and it must be
{0:MM/dd/yyyy}.
Thanks.
Eddy
"Brian Smith" <smitho@.mantech-wva.com> wrote in message
news:074e01c347cc$f65bfcf0$a001280a@.phx.gbl...
> Eddy,
> I found myself having this problem the other day and
> couldn't find any documentation in the MSDN other than for
> numbers. Here is what you need to put in the format
> string:
> {0:mm/dd/yyyy}
> Also,
> http://asp.net/ is a really good site for anything related
> to ASP .NET or .NET in general. The people in the Forums
> there are very helpful and usually can answer my questions
> within an hour.
>
> >--Original Message--
> >Hi,
> >I need to display a DateTime field in 'mm/dd/yyyy' in a
> DataGrid.. On
> >myGrid1 - Properties - Columns - myColumn1 - Text format
> string:
> >I tried to put 'mm/dd/yyyy' in there and it
> displays 'mm/dd/yyyy' in stead
> >of '04/10/2001'. I know I didn't do it right. Please let
> me know what's the
> >correct way to display a 'mm/dd/yyyy' format for a
> DateTime coulmn.
> >Thanks.
> >Eddy
> >.
"Eddy Soeparmin" <esoeparmin@.clientprofiles.com> wrote in message news:<udPQR07RDHA.2008@.TK2MSFTNGP11.phx.gbl>...
> Hi,
> I need to display a DateTime field in 'mm/dd/yyyy' in a DataGrid.. On
> myGrid1 - Properties - Columns - myColumn1 - Text format string:
> I tried to put 'mm/dd/yyyy' in there and it displays 'mm/dd/yyyy' in stead
> of '04/10/2001'. I know I didn't do it right. Please let me know what's the
> correct way to display a 'mm/dd/yyyy' format for a DateTime coulmn.
> Thanks.
> Eddy
try {0:d} in the datafomatstring property
John
Text if not null
Below I can change the backcolor if its not blank but I want to change the text :
Put "Confirmed" if it is not null, and "Not Confirmed" if it is null.
Dim conf As String
conf = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "confirm_id"))If conf <> "" Then
e.Item.BackColor = System.Drawing.Color.AliceBlueEnd If
How can I do this?Try (3 is just an example, you'll have to use the right column index)
e.Item.Cells[3].Text = "Confirmed"
Regards
Fredr!k
I got the following error:
'Cells' is not a member of 'System.Web.UI.WebControls.DataListItem'.
I am using a datalist is there a way of doing this with a datalist?
text length in pixels
I am trying to resolve the following scenario:
We have a text box of fixed width that by default should display only 1 line
of text without a scrollbar indicator.
If there are multiple lines of text then we need to to indicate that by
displaying a button alongside the textbox that the user can click on to
expand the height of the text box. The height would be, say, 4 lines of
text. If there are more than 4 lines of text then we need to display a
vertical scrollbar.
To be able to achieve this, it seems, we need to be able to compare the
length of the text with that of the textbox. If we can somehow get the
length in pixels that would solve part of the problem?
Any ideas would be greatly appreciated...
Thanks, VishalInstead of trying to accomplish this by pixels (the hard way), try this:
A textbox that does not have any styling applied to it will use a font where
different characters are different widths (capital W is wider than lower
case l). So, pick a number of characters that you consider to be one full
line of text. You can programmatically check the number of characters in a
textbox and when you reach your one line limit, you can change the rows
property of the textbox to 4. The vertical scroll bar is built in, so you
don't have to worry about enabling it when needed.
"Vishal Gupta" <vishalg_99@.hotmail.com> wrote in message
news:eqX6Zmr3DHA.2112@.TK2MSFTNGP10.phx.gbl...
> Hi,
> I am trying to resolve the following scenario:
> We have a text box of fixed width that by default should display only 1
line
> of text without a scrollbar indicator.
> If there are multiple lines of text then we need to to indicate that by
> displaying a button alongside the textbox that the user can click on to
> expand the height of the text box. The height would be, say, 4 lines of
> text. If there are more than 4 lines of text then we need to display a
> vertical scrollbar.
> To be able to achieve this, it seems, we need to be able to compare the
> length of the text with that of the textbox. If we can somehow get the
> length in pixels that would solve part of the problem?
> Any ideas would be greatly appreciated...
> Thanks, Vishal
Check out the .NET Framework Class Library for:
Graphics.MeasureString Method (String, Font)
"Scott M." <s-mar@.BADSPAMsnet.net> wrote in message
news:%233OjMrr3DHA.3656@.TK2MSFTNGP11.phx.gbl...
> Instead of trying to accomplish this by pixels (the hard way), try this:
> A textbox that does not have any styling applied to it will use a font
where
> different characters are different widths (capital W is wider than lower
> case l). So, pick a number of characters that you consider to be one full
> line of text. You can programmatically check the number of characters in
a
> textbox and when you reach your one line limit, you can change the rows
> property of the textbox to 4. The vertical scroll bar is built in, so you
> don't have to worry about enabling it when needed.
>
> "Vishal Gupta" <vishalg_99@.hotmail.com> wrote in message
> news:eqX6Zmr3DHA.2112@.TK2MSFTNGP10.phx.gbl...
> > Hi,
> > I am trying to resolve the following scenario:
> > We have a text box of fixed width that by default should display only 1
> line
> > of text without a scrollbar indicator.
> > If there are multiple lines of text then we need to to indicate that by
> > displaying a button alongside the textbox that the user can click on to
> > expand the height of the text box. The height would be, say, 4 lines of
> > text. If there are more than 4 lines of text then we need to display a
> > vertical scrollbar.
> > To be able to achieve this, it seems, we need to be able to compare the
> > length of the text with that of the textbox. If we can somehow get the
> > length in pixels that would solve part of the problem?
> > Any ideas would be greatly appreciated...
> > Thanks, Vishal
Saturday, March 24, 2012
Text on the button does not display
Hello,
I am new to Dot Net. In the following code, the text on the button does not display. However, if I add the following for the button control, it does display.
Text ="Confirm"
Also, instead of using <asp:/> I tried using the following and the text still did not display and I get the error message: "'Click' is not a member of 'ASP.SimpleForm_aspx'"
<p><button id="mybutton" OnServerClick="Click" runat="server"> Confirm</button></p>
<html>
<head>
...
</head>
<body>
<form runat="server">
<h2>Take the Survey!</h2>
<p>Name:<br />
<input type="text" id="txtName" runat="server" /></p>
<p>Email:<br />
<input type="text" id="txtEmail" runat="server" /></p>
<p>Which server technologies do you use?<br />
<select id="servermodel" runat="server" multiple="true">
<option>ASP.NET</option>
<option>JSP</option>
</select></p>
<p>Do you like .NET so far?<br />
<select id="likedotnet" runat="server">
<option selected>Yes</option>
<option>No</option>
</select></p>
<asp:button id="mybutton" OnServerClick="Click" Confirm runat="server" />
</form>
</body>
</html>
Thanks in advance
Number one: The asp button has a field called text. This is what sets the text that appears on the button. This value has to be set for the text to display.
Number two: you have onserverclick as your click command. This should just be onclick="Click".
Hope this helps
When you tell your button, onServerClick="Click" your telling it, to execute a sub or function called "Click" which doesnt exist in your example.
To get the text of your button to show up, do this.
<asp:ButtonText="MyButton"runat="server"ID="Button1"/>
Msamford and Freakyuno,
Thanks a lot for your response. I tried playing with the code.
As requested by you, when I try any one of the following within the aspx code the display works fine and when I click on the "Confirm" button I see "Done" at the bottom of the screen.
<asp:button id="mybutton" Text="Confirm" OnServerClick="Click" runat="server"/>
<asp:Button Text="Confirm" runat="server" ID="Button1" />
However, when I use the following line of code, I see that the output is exactly the same but when I click on the "Confirm" button, I see an "Error on Page" at the bottom of the screen instead of "Done". I tried the following Code Behind for the event handler.
<p><button id="mybutton" OnClick="Click" runat="server">Confirm</button></p>
CodeBehind
<script runat="server" language="C#>
void Click(Object s, EventArgs e){
Response.Write(mybutton.ID);
}
</script>
Code Behind
//First off we import some useful namespaces
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
//All code-behind classes generally inherit from Page
public class SimpleForm3 : Page
{
// Declare the presentation elements on the ASPX page
protected Button mybutton;
//Here's the Click Handler just as it appeared before
public void Click(Object s, EventArgs e){
}
}
I am not sure why. Thanks in advance!!!
Hello,
I added the C# code inside a server-side script block within the header tag of the aspx page. Also, s I am trying to grasp html controls and web forms, I believe the OnServerClick specifies the asp dot net handler for clicks on the button for html controls?
SimpleForm.aspx
<html>
<head>
<script runat="server" language="C#">
void Click(Object s, EventArgs e){
Response.Write("Your name is: " + txtName.Value + "<br />");
Response.Write("Your e-mail is: " + txtEmail.Value + "<br />");
Response.Write("You like to work with: " + servermodel.Value + "<br />");
Response.Write("You like NET: " + likedotnet.Value);
}
</script>
</head>
<body>
<form runat="server">
<h2>Take the Survey!</h2>
<p>Name:<br />
<input type="text" id="txtName" runat="server" /></p>
<p>Email:<br />
<input type="text" id="txtEmail" runat="server" /></p>
<p>Which server technologies do you use?<br />
<select id="servermodel" runat="server" multiple="true">
<option>ASP.NET</option>
<option>JSP</option>
<option>PHP</option>
<option>CGI</option>
<option>ColdFusion</option>
</select></p>
<p>Do you like .NET so far?<br />
<select id="likedotnet" runat="server">
<option selected>Yes</option>
<option>No</option>
</select></p>
<p><button id="mybutton" OnServerClick="Click" runat="server">Confirm</button></p>
</form>
</body>
</html>
Thanks
dotnetnew123
dotnetnew123 wrote:
However, when I use the following line of code, I see that the output is exactly the same but when I click on the "Confirm" button, I see an "Error on Page" at the bottom of the screen instead of "Done". I tried the following Code Behind for the event handler.
<p><button id="mybutton" OnClick="Click" runat="server">Confirm</button></p>
the problem here is you have no asp: in your tag. Therefore when you click the button it is not accessing your servercode. The only way to access the click event is to have the servercontrol properly written with <asp:button ...></asp:button>
Other folks have given you the answer on this, but I'll try since you don't seem to be doing what they advise. Some of my advice might be moot since it could be just a cutting and pasting error, but here we go:
You don't have the @.Page declaration at the top of your document (above even the <html> tag). I just tried your code as-is but with the added page tag and it works just fine.
Thanks all. It works fine now!
Text overflow in Div
Hi guys
Am new to asp.net. I am tryin to display some information from database into a label element , issue is the text gets overflow rather wrapping within the element(as in notepad).
any help/advice much appreciated
-->
<divid="columnright">
<divclass="rightblock"><asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:SwapNetDB %>"SelectCommand="SELECT id, itemdate, title, description, photo, albumid, staticURL FROM Announcements WHERE (id = @dotnet.itags.org.id)">
<SelectParameters>
<asp:ParameterType="Int32"DefaultValue="1"Name="id"></asp:Parameter>
</SelectParameters>
</asp:SqlDataSource>
<asp:FormViewID="FormView1"runat="server"DataSourceID="SqlDataSource1"DataKeyNames="id"
OnDataBound="FormView1_DataBound">
<ItemTemplate>
<h3>
<asp:LabelHeight="100px"Text='<%# Eval("title") %>'runat="server"ID="titleLabel"/>
</h3>
<divclass="itemdetails">
<p>
<asp:LabelText='<%# Eval("itemdate","{0:D}") %>'runat="server"ID="itemdateLabel"/>
</p>
</div>
<p>
<asp:labelBorderStyle="None"BackColor="transparent"Text='<%# Eval("description") %>'runat="server"ID="descriptionLabel"/>
</p>
</ItemTemplate></asp:FormView>
ID="LinkButton4"runat="server"OnClick="prevButton_Click">« Previous Article</asp:LinkButton>
</div>
</div>
Css info:
.leftblock
{
border:1pxsolid#DBDB79;padding:15px;
margin-bottom:10px;background:#FEFAABurl(../../images/background_columnleft.gif)repeat-y;
vertical-align:top;}
.leftblockh2,.rightblockh2,.fullwidthh2
{
font-size:1.6em;}
#columnleft
{
float:left;width:240px;
/*position: relative; */
}
#columnright
{
margin-left:245px;width:446px ;
/*position: relative; */
}
.rightblock
{
border:1pxsolid#DBDB79;padding:0px;
margin-bottom:1px;margin-right:1px;
background:#FEFFABurl(../../images/background_columnright.gif)repeat-y;position:relative;
}
any help much appreciated
Labels render as an html <span> element. Apply a width to it.
text searching through html/.apx files in .net
Kindly guide me how can i do this.
Any help/sample code will be appreciatedHi,
Take a look @.
-Creating Search Pages with Index Server and .NET
-WhatuSeek.com
HTH
Thursday, March 22, 2012
text/plain ContentType
Here's what I'm doing:
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "text/plain"
Response.WriteFile(sExportPath)
Response.Flush()
Response.Close()
What happens is that I did an open/save dialog.
If I choose Save, it wants to save the file as MyASPXPageName.aspx
and if I choose open, it opens the .aspx file which contains text.
Anyway that I can actually get this to open in the browser?May be your IIS is writing out a header for caching.
Sekhar.
"George Durzi" <gdurzi@.hotmail.com> wrote in message
news:uYb$u1JfEHA.712@.TK2MSFTNGP09.phx.gbl...
> I'm writing an ASPX page to open a .txt file, and display it in the
browser.
> Here's what I'm doing:
> Response.ClearContent()
> Response.ClearHeaders()
> Response.ContentType = "text/plain"
> Response.WriteFile(sExportPath)
> Response.Flush()
> Response.Close()
> What happens is that I did an open/save dialog.
> If I choose Save, it wants to save the file as MyASPXPageName.aspx
> and if I choose open, it opens the .aspx file which contains text.
> Anyway that I can actually get this to open in the browser?
My page is building the response, and unless I add something manually to the
header, such as
Response.AddHeader "content-disposition", "attachment; filename=""" &
fileName & """"
the file should open automatically in the browser. It works fine for PDF
files...
"Chandra Sekhar" <Chandra.Shekhar@.am.joneslanglasalle.com> wrote in message
news:e23snIKfEHA.2848@.TK2MSFTNGP10.phx.gbl...
> May be your IIS is writing out a header for caching.
> Sekhar.
>
> "George Durzi" <gdurzi@.hotmail.com> wrote in message
> news:uYb$u1JfEHA.712@.TK2MSFTNGP09.phx.gbl...
> > I'm writing an ASPX page to open a .txt file, and display it in the
> browser.
> > Here's what I'm doing:
> > Response.ClearContent()
> > Response.ClearHeaders()
> > Response.ContentType = "text/plain"
> > Response.WriteFile(sExportPath)
> > Response.Flush()
> > Response.Close()
> > What happens is that I did an open/save dialog.
> > If I choose Save, it wants to save the file as MyASPXPageName.aspx
> > and if I choose open, it opens the .aspx file which contains text.
> > Anyway that I can actually get this to open in the browser?
text/plain ContentType
Here's what I'm doing:
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "text/plain"
Response.WriteFile(sExportPath)
Response.Flush()
Response.Close()
What happens is that I did an open/save dialog.
If I choose Save, it wants to save the file as MyASPXPageName.aspx
and if I choose open, it opens the .aspx file which contains text.
Anyway that I can actually get this to open in the browser?May be your IIS is writing out a header for caching.
Sekhar.
"George Durzi" <gdurzi@.hotmail.com> wrote in message
news:uYb$u1JfEHA.712@.TK2MSFTNGP09.phx.gbl...
> I'm writing an ASPX page to open a .txt file, and display it in the
browser.
> Here's what I'm doing:
> Response.ClearContent()
> Response.ClearHeaders()
> Response.ContentType = "text/plain"
> Response.WriteFile(sExportPath)
> Response.Flush()
> Response.Close()
> What happens is that I did an open/save dialog.
> If I choose Save, it wants to save the file as MyASPXPageName.aspx
> and if I choose open, it opens the .aspx file which contains text.
> Anyway that I can actually get this to open in the browser?
>
My page is building the response, and unless I add something manually to the
header, such as
Response.AddHeader "content-disposition", "attachment; filename=""" &
fileName & """"
the file should open automatically in the browser. It works fine for PDF
files...
"Chandra Sekhar" <Chandra.Shekhar@.am.joneslanglasalle.com> wrote in message
news:e23snIKfEHA.2848@.TK2MSFTNGP10.phx.gbl...
> May be your IIS is writing out a header for caching.
> Sekhar.
>
> "George Durzi" <gdurzi@.hotmail.com> wrote in message
> news:uYb$u1JfEHA.712@.TK2MSFTNGP09.phx.gbl...
> browser.
>
textarea and scrollbar
Hi All,
in my application, I am using textarea html control to display large text. I have to make this as readonly, so I am setting its 'Disabled' property 'true'. My problem is when content to show is larger than the textarea it does not show vertical scroll bar. I am setting overflow property to auto also but no luck. can someone please help me ?.
Thanks,
Amit
Don't disable it, set it ReadOnly... you'll have to do some funky coding, probably with Javascript.
Otherwise, have you looked at any other controls? Like a multiline <asp:Textbox...> control?
If you are using an asp:textbox, you need to put in this attribute,
TextMode="MultiLine"
So it would be something like,
<asp:TextBox ID="TextBox1" TextMode="MultiLine" runat="server"></asp:TextBox>
Thanks Curt. It is working. I added following line in code behine and it works
this.txtArea.Attributes.Add("readonly","true");
Textbox
I need to set the textbox to allow numeric input only and it automatically display with thousand separator and 2 decimal symbol.. how to do this?
Please help
Thanks
WinanjayaThere are a few ways to do it. there are validator controls that will check tha value of your text box client side or you can validate on the server side using regular expressions.
public static bool Validate(string DirtyString, string RegularExpresion)
{
bool passed = true;
System.Web.HttpContext curr = System.Web.HttpContext.Current;
string currcell = curr.Server.HtmlEncode(DirtyString);
currcell = currcell.Trim();
if (passed == PassedFilter(currcell,RegularExpresion))
{
return true;
}
else
{
return false;
}
}
public static bool PassedFilter(string DirtyString, string FilterExp)
{
string cleanstring = "";
foreach (Match charMatch in System.Text.RegularExpressions.Regex.Matches(DirtyString, FilterExp))
{
cleanstring = cleanstring + charMatch;
}
if (cleanstring.Length == DirtyString.Length)
{
return true;
}
else
{
return false;
}
}
This is the server side way. Pass the string you want to validate and the regular expression to validate against it.
Tuesday, March 13, 2012
Textbox - enter value and display record in FormView
Hi:
I would like to have user enter a value in the text box and have a record shown in the FormView. I know how to do it with the dropdown list showing the values but the list would be too long to display. I onder to find a record I would need to have user type it in. The field to seach on is a unique (key) field.
CAn you suggest a method?
Thanks.
It is exactly the same, except that you will need a submit button
<asp:TextBox id="txt1" runat="server" />
<asp:Button OnClick="submit" Text="Submit" runat="server" />
and on postback
Sub submit(sender As Object, e As EventArgs)
re-bind using this query "SELECT * FROM SomeTable Where ID = " & txt1.Text
End Sub
Is this what u mean?
I think he just want to know the TextChange event on TextBox.you can use this to show you record in FormView.but this textchange event i think prefer for Asp.net Ajax enabled website.i also think there is one event name like textbox lose focus,you can found this.
you mean onBlur (maybe OnServerChange?)
Anyway... I'm pissed of cause I had 199 points and now I have only 195 miserable points... somethign stinks in here!!!
kidding,
Mauro
Hi:
Thanks for your advise. I tried few things as follows:
1) I created a textbox txt1 and a button
2) I placed controls in the Ajax update panel
3) I added formview based on the query and added a parameter as follow: (permit# is my search field and my key)
<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>"
SelectCommand="SELECT [PermitNo], [TaskId], [ProjectManagerId], [OnSiteFirstName] FROM [Permits] where PermitNo = @.PermitNo">
<SelectParameters>
<asp:ControlParameterControlID="txt1"Name="PermitNo"PropertyName="Text"/>
</SelectParameters>
</asp:SqlDataSource>
So, when I type Permit number in my box it runs a query and show my record in formview.
This works perfectly. But I need to write something so it will test for "not found" so I could display message "Record not found". Do you have any ideas how I can do it? I use C# but possibly I can do it with ASP??
I would appreciate your assistance.
Hi:
Thanks for your advise. I tried few things as follows:
1) I created a textbox txt1 and a button
2) I placed controls in the Ajax update panel
3) I added formview based on the query and added a parameter as follow: (permit# is my search field and my key)
<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>"
SelectCommand="SELECT [PermitNo], [TaskId], [ProjectManagerId], [OnSiteFirstName] FROM [Permits] where PermitNo = @.PermitNo">
<SelectParameters>
<asp:ControlParameterControlID="txt1"Name="PermitNo"PropertyName="Text"/>
</SelectParameters>
</asp:SqlDataSource>
So, when I type Permit number in my box it runs a query and show my record in formview.
This works perfectly. But I need to write something so it will test for "not found" so I could display message "Record not found". Do you have any ideas how I can do it? I use C# but possibly I can do it with ASP??
I would appreciate your assistance.
FormView lets u define a template for "no data"
<emptydatatemplate>
No records available.
</emptydatatemplate>
More info at:http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.formview.emptydatatemplate(VS.80).aspx
Regards,
Mauro
Yes, thank so much for your help. I got this working!!!!
It is Friday afternoon - I will check it on Monday - but I am sure it will work! Thanks for all your assistance .
TextBox (v2.0)
Is it possible to have a textbox always display a particular format, my
client wishes to have the textbox always display the text in this format -
0,000.00.
Is there anyway of achieving this?
Thanks
KevPlease see my answer to this same question you posted on the webcontrols
newsgroup.
-- Peter Blum
www.PeterBlum.com
Email: PLBlum@.PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
"Mantorok" <none@.tiscali.co.uk> wrote in message
news:da3g4o$6so$1@.newsfeed.th.ifl.net...
> ASP.Net 2.0 question.
> Is it possible to have a textbox always display a particular format, my
> client wishes to have the textbox always display the text in this format -
> 0,000.00.
> Is there anyway of achieving this?
> Thanks
> Kev