.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

problem in retriving text from a textbox

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :ASP.Net

<asp:DataList ID="DataList1" runat="server" DataSourceID="ObjectDataSource1"
Height="132px" style="font-size: medium; font-family: Georgia; color: #006600"
Width="307px" DataKeyField="scrapsndrcod"
<b> <%#Eval("nam") %>:</b>
<%#Eval("scrapmsg") %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /> &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CommandName="rply" >Reply</asp:LinkButton>
&nbsp;<asp:LinkButton ID="LinkButton1" runat="server" CommandName="delete" CommandArgument='<%#Eval("scrapcod") %>'>delete</asp:LinkButton>
<asp:Panel ID="Panel1" runat="server" Visible="false">
<asp:TextBox ID="TextBox1" TextMode="MultiLine" runat="server"></asp:Tex

View Complete Post

More Related Resource Links

text posing problem in different resolution


Hiiiii coders ,

iam using 14px for my font size in my project . It works fine when i run it on my system. But when i tried to run it on higher resolution the all the text gets shrinked . what is the best way to set font size for my text for all resolutions?

kindly provide me some code snippets.

thanx and regards 

Textbox text populated by Session Variable wont update into SQL with new text


Hi everyone, I have what I think is a weird issue. I send text from one page to another via Session Variable. When page 2 loads, the text box has the session text set, but if the user changes the text and clicks the button, the SQL database is update with the original session text. If I remove the redirect from the page 2 button_Click method, then, the page refreshes with the textbox reverting to the session text and thr SQLDataSource has the session text added to it.

Why would the button click cause the textbox refresh with the text from the pageLoad before updating the data source?


Partial Class _1
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Session("UpdateProd") = "Have some text here to send to a textbox on page 2"
    End Sub
End Class

Partial Class _2
    Inherits System.Web.UI.Page


Crystal Reports can grow fields with large amounts of text layout problem


A can grow field in the details section of a crystal report may have so much text that the section will be larger than the remaining space available on the page (the space below the previous record).  The section has vertical lines on it with Extend to bottom of section when printing set to true.  The section starts on a new page (and may continue on the following one).  I want it to start on the page where the last record was laid out, and continue to the new page without leaving a gap with vertical lines on it.  I'm using Crystal Reports 9 and I can't work out how to do it. Has anyone got a solution?

Replace Text in textbox in word document using interop and asp.net

Hi all,  I'm trying to create a function to replace fields in a word document using asp.net. The fields are marked in the document using ###field### and I need to replace them with the data from the DB. The code I have works fine for the body of the word document but doesn't appear to work if the text is contained within a textbox, is there a way to correct this? Here's the code I am currently using Dim Contract as string Dim word As New Word.Application        Dim doc As Word.Document        Try            word.Documents.Open("c:\FYI.doc")            word.Visible = True             doc = word.ActiveDocument            Dim myStoryRange As Microsoft.Office.Interop.Word.Range            For Each myStoryRange In doc.StoryRanges                With myStoryRange.Find                    .Text = "###field###&quo

TextBox shows binding source text when window load, so why not with the ComboBox?

How can I get a ComboBox to show the binding source value when my window opens?  I have been searching all day for a solution to this, but cannot find anything.  So I have created a sample project to demonstrate my problem.  Below is a Vehicle class, very simple, two members Category and Make.  Category is an enumeration, Make is a string. namespace ComboExample { public class Vehicle { // Constants and enumerations public enum eCategory { Road, Air, Sea } // Attributes public eCategory Category { get; set; } public String Make { get; set; } // Construction public Vehicle(eCategory Category, String strMake) { this.Category = Category; this.Make = strMake; } } } Here is the C# for the MainWindow.  A new Vehicle object is created as a member.  In the constructor I set a data-provider in the XAML to this Vehicle object.  There is a button event for showing the values of the controls and objects so I can check the binding. namespace ComboExample { // Interaction logic for MainWindow.xaml public partial class MainWindow : Window { // Attributes Vehicle m_Car = new Vehicle(Vehicle.eCategory.Road, "BMW"); // Construction public MainWindow() { InitializeComponent(); // link data-p

Problem with JavaScript on Textbox

 I have a textbox which is populated by an external javascript file which I cannot alter without affecting another part of the system. What I would like to do is once this textbox has a value to do something with it. The javascript that I want to use is fine, but it won't automatically when a value has populated it i.e. onchange. It will work when the event is onfocus. Is there away in which I can automatically fire off my javascript event when a value has entered the textbox from another piece of javascript code?  

Highlight text in a textbox

I have a textbox that could be 100 chars long. If I know the start & end positions of the text to highlight (via start & end position textboxes), how can I just highlight that portion of the characters in the textbox? 

Problem importing text files with binary zeros (0x00) via SSIS(SQL2005). It is all fine when using D

Hi.   There is a "text" file generated by mainframe and it has to be uploaded to SQL Server. I've reproduced the situation with smaller sample. Let the file look like following: A17     123.17  first row          BB29    493.19  second             ZZ3     18947.1 third row is longer And in hex format: 00:  41 31 37 20 20 20 20 20 ? 31 32 33 2E 31 37 20 20  A17     123.17  10:  66 69 72 73 74 20 72 6F ? 77 0D 0A 42 42 32 39 20  first row??BB29 20:  20 00 20 34 39 33 2E 31 ? 39 20 20 73 65 63 6F 6E     493.19  secon30:  64 0D 0A 5A 5A 33 20 20 ? 20 20 20 31 38 39 34 37  d??ZZ3     1894740:  2E 31 20 74 68 69 72 64 ? 20 72 6F 77 00 69 73 20  .1 third row is 50:  6C 6F 6E 67 65 72       ?                          longer          I wrote "text" in quotes because sctrictly it is not pure text file - non-text binary zeros (0x00) happen sometimes instead of spaces (0x20).   The table is: CREATE TABLE eng ( src varchar (512) )   When i upload this file into SQL2000 using DTS or Import wizard, the table contains: select src, substring(src,9,8), len(src) from eng <               src                ><substr>             <len> A17     123.17  first row           123.17                  25BB29                                493.19                  22ZZ3     18947.1 third row           18947.1                 35   As one can see, everything was importe

problem with javascript in multiline textbox

 I am setting Maxlength of a textbox using javascript. Take maxlegth as 100.As we know Enter key is taking two char space. But i want to avoid this. i.e. if i press enter key after 96th char it should allow me to enter four more char where now it is allowing only 98. This is wat i am using  function textboxMultilineMaxNumber(txt,maxLen) { try { if(txt.value.length > (maxLen-1)) return false; } } catch(e){ } }

Problem passing a text box value from aspx.cs page to SelectParameters in aspx page

Hi,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)      {           AccessDataSource1.SelectParameters["inputValue"].DefaultValue = TextBox1.Text;           string test = AccessDataSource1.SelectParameters["inputValue"].DefaultValue;                      //string inputValue = TextBox1.Text;          //Response.Write(inputValue);         // AccessDataSource1.SelectParameters.Add("@name", inputValue);          //Response.Write(@inputValue);                              } protected void btn_click(Object sender, ImageClickEventArgs e)     {          AccessDataSource1.SelectParameters["inputValue"].DefaultValue = TextBox1.Text;          //An alternate option I have used is          //string inputValue = TextBox1.Text;         // AccessDataSource1.Selec

Textbox in headertemplate gridview lost text in updatepanel

Hi everybody,I never post on this forum because since I write code in asp.net I always solve issues by finding solutions with other members who have the problem before me. But this time I don't know how to do...This is my problem : I have a gridview inside an updatepanel and i modified some headers in order to filter the collection. This worked but when my updatepanel is updating, my textbox for the filter clear the value (the text) and lost focus.Is there any solution ?This is my code : <asp:UpdatePanel ID="UpdatePanelOrders" runat="server" UpdateMode="Conditional"> <Triggers> <asp:AsyncPostBackTrigger ControlID="btFilterClear" /> </Triggers> <ContentTemplate> <asp:GridView ID="OrdersView" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" ShowHeaderWhenEmpty="True" EnablePersistedSelection="True" PagerStyle-CssClass="pager" AlternatingRowStyle-CssClass="alter_row" SelectedRowStyle-CssClass="select_row" DataKeyNames="CustId,SalesOrders,CompCode,CustPO"> <Columns>

When I click on a TextBox the text moves a little bit for Vertical Alignment

I have a Grid of text boxes defined in the XAML using the following code:         <Border Grid.Row="2" Grid.Column="11" Style="{StaticResource BorderStyleContent}" >             <TextBox Text="-15.11" Style="{StaticResource EditableTextBox}"/>         </Border> The styles are defined below:         <Style x:Key="BorderStyleContent" TargetType="Border">             <Setter Property="BorderBrush" Value="Black"/>             <Setter Property="BorderThickness" Value="1"/>             <Setter Property="Padding" Value="2"/>             <Setter Property="SnapsToDevicePixels" Value="True"/>         </Style>         <Style x:Key="EditableTextBox" TargetType="TextBox">         &nb

Textbox Text Property

I am new to VB and I have read that if I don't explicity cast variable types it will eat up performance. I have been casting certain objects, such as values from data readers, but I was wondering if the object has a property that says it is a string, like the textbox "Text" property, if I need to still cast that as a string.   Right now my code says "txtSearch.Text" but should I be using "txtSearch.Text.ToString()"?   Thanks in advance for the help!

A problem about CreateWindow - "balloon (tool) tip text window"

I dlike to use balloon tool tip text "TTM_ADDTOOL" in global environment. now..,I am using a code which works fine but in the main form - in my own app only..When i use mainwindowhandle of notepad it doesnt works - tooltip is not displayed. When my mouse cursor is away from my form and my mouse cursor is above notepad = tooltip is not displayed. Does exist any solution which will displaying baloon tipText on concrete coordinate? Any idea, solution, link..? more concrete.. I Tryed to create new tip window on concrete coordinate. Code is compiled., without errors, but new window is not visible. Somebody who can help me?   // Create an instance handle. Asm = Assembly.GetExecutingAssembly(); hInstance = Marshal.GetHINSTANCE(Asm.GetModules()[0]); // Create the ToolTip window. WinHandle = CreateWindowEx( WS_EX_TOPMOST, TOOLTIPS_CLASS, "Balloon Help Message" , WS_POPUP | TTS_NOPREFIX | TTS_BALLOON, 50, 50, 320, 240, IntPtr.Zero, IntPtr.Zero, hInstance, IntPtr.Zero); //display tool tip ShowWindow(WinHandle, 1);  

Problem tabbing among text boxes with AJAX

We are having a problem with a form with four text boxes. If you enter a value in the first two boxes, pressing TAB as you switch between the text boxes, the data is retained in the text box as you would expect.  However, the third and fourth text boxes won't retain any data.  This happens in IE 8 but not FireFox 3.5.  The problem won't occur if you use the mouse to switch between text boxes. The problem goes away if we remove the AJAX code, but we want to retain the AJAX code so that some other things happen without postbacks.  I can upload a sample website if that will help, but I don't see where I can upload the files. We're using Visual Studio 2010 and VB.NET in an ASP.NET project.   Protected ToolkitScriptManager1.SetFocus(TextBox2)     Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChangedEnd Sub   ToolkitScriptManager1.SetFocus(TextBox3)     Protected Sub TextBox2_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.TextChangedEnd Sub   ToolkitScriptManager1.SetFocus(TextBox4)      Protected Sub TextBox3_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox3.TextChangedEnd Sub  

Unable to fetch text from a textbox with numeric up-down extender

I have a textbox with numeric updown extender.I want the text of the textbox.I have written code in code file is String a=txtHour.Text//  Source FIle COde<asp:TextBox ID="txtHour" runat="server" ReadOnly="True" Width="45"                     Style="text-align:center" Height="20px"></asp:TextBox>                                       <cc1:NumericUpDownExtender ID="NumericUpDownExtenderHr" runat="server"                     Enabled="True"                     Minimum="00" Maximum="23"                    TargetControlID="txtHour" Width="40">                </cc1:NumericUpDownExtender>

Problem with overriding OnPaint method of System.Windows.Forms.Textbox

Hi,   I want to change the border colour of the Textbox. However, when I override the OnPaint method, some strange behaviour occurs.   The new border is drawn, as is the textbox background. However, the text itself appears in bold and only while I actually type something in, afterwards it disappears. I have provided a sample of my code here:         protected override void OnPaint(PaintEventArgs e)         {             base.OnPaint(e);             Rectangle rect = new Rectangle(0, 0, this.Width, this.Height);             ControlPaint.DrawBorder(e.Graphics, rect, _BorderColour, ButtonBorderStyle.Solid);         }   I have also set the style of the control to Userpaint, so that the paint method is actually used. Does anybody know how to solve this issue?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend