|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
C# locked textboxesHi,
I know I can set my form's textboxes ReadOnly property to disable them, but how can I "lock" them instead? THe user still needs to be able to select the text in them so they can paste it if needed. (I think this used to be possible in VB, how can I do it in C#)? thanks in advance, Axel "Axel" <n@pe.com> wrote in message Is this a WinForms or WebForms question...?news:ua8oz1$7JHA.1568@TK2MSFTNGP06.phx.gbl... > I know I can set my form's textboxes ReadOnly property to disable them, > but how can I "lock" them instead? THe user still needs to be able to > select the text in them so they can paste it if needed. (I think this used > to be possible in VB, how can I do it in C#)? Mark Rae [MVP] wrote:
> "Axel" <n@pe.com> wrote in message this is a question about a standard Textbox (dragged from the Standard > news:ua8oz1$7JHA.1568@TK2MSFTNGP06.phx.gbl... > >> I know I can set my form's textboxes ReadOnly property to disable >> them, but how can I "lock" them instead? THe user still needs to be >> able to select the text in them so they can paste it if needed. (I >> think this used to be possible in VB, how can I do it in C#)? > > Is this a WinForms or WebForms question...? > > Hi Mark, Toolbox menu). Sorry, I am a C# newbie so I don't know about WinForms or WebForms, but I hope that answers your question (?) thanks in advance Axel
Show quote
Hide quote
"Axel" <n@pe.com> wrote in message This is the ASP.NET newsgroup, for questions about developing web news:ukBfgPA8JHA.4100@TK2MSFTNGP06.phx.gbl... >>> I know I can set my form's textboxes ReadOnly property to disable them, >>> but how can I "lock" them instead? THe user still needs to be able to >>> select the text in them so they can paste it if needed. (I think this >>> used to be possible in VB, how can I do it in C#)? >> >> Is this a WinForms or WebForms question...? > > This is a question about a standard Textbox (dragged from the Standard > Toolbox menu). Sorry, I am a C# newbie so I don't know about WinForms or > WebForms, but I hope that answers your question (?) applications using ASP.NET. If your question relates to the <asp:TextBox /> web control or the <input type="text" /> HTML control (though I suspect it doesn't), you're in the right newsgroup. However, if your question relates to developing a desktop C# application (which I suspect it is), then you're in the wrong newsgroup and need to post in microsoft.public.dotnet.languages.csharp Mark Rae [MVP] wrote:
Show quoteHide quote > "Axel" <n@pe.com> wrote in message Hi Mark,> news:ukBfgPA8JHA.4100@TK2MSFTNGP06.phx.gbl... > >>>> I know I can set my form's textboxes ReadOnly property to disable >>>> them, but how can I "lock" them instead? THe user still needs to be >>>> able to select the text in them so they can paste it if needed. (I >>>> think this used to be possible in VB, how can I do it in C#)? >>> >>> Is this a WinForms or WebForms question...? >> >> This is a question about a standard Textbox (dragged from the Standard >> Toolbox menu). Sorry, I am a C# newbie so I don't know about WinForms >> or WebForms, but I hope that answers your question (?) > > > This is the ASP.NET newsgroup, for questions about developing web > applications using ASP.NET. If your question relates to the <asp:TextBox > /> web control or the <input type="text" /> HTML control (though I > suspect it doesn't), you're in the right newsgroup. Yes, this is what it relates to - that's why I thought the framework group was the correct one(?) here is my current code: this is a part of the page (OI_testdetails.ascx) (it is actually a Web User Control, but AFAIK that should behave the same as a page): <div class="hbox"> <div id="OI_Details" runat="server" class="hpanel"> <table class="FormLblTxt"> <tr><td><asp:Label ID="lblPriority" runat="server" Text="Priority:"></asp:Label></td> <td><asp:TextBox ID="txtPriority" runat="server" Enabled="false"></asp:TextBox></td> </tr> <tr> <td><asp:Label ID="lblStatus" runat="server" Text="Status:"></asp:Label></td> <td><asp:TextBox ID="txtStatus" runat="server" Enabled="false"></asp:TextBox></td> </tr> </table> </div> </div> What I would like is the asp:Textbox controls to be so that the users can highlight text contained in the textbox to copy it to the clipboard, but they can not change the text. The above code create INPUTs with the disabled attribute: <table style="width: 100%; min-width: 300px"> <tr> <td class="leftlabel"> Customer:</td> <td> <input name="ctl00$ContentPlaceHolder1$OI_Details1$txtCustomer" type="text" value="GE Plastics" id="ctl00_ContentPlaceHolder1_OI_Details1_txtCustomer" disabled="disabled" class="stdTextbox" style="width: auto; margin-right: auto;min-width: 200px" /></td> </tr> In my browser I can not select / highlight the text at all... could this be a problem with my skin file or is this behavior by design? thanks in advance Axel "Axel" <n@pe.com> wrote in message <asp:TextBox ID="txtPriority" runat="server" ReadOnly="true" />news:e5QiT2C8JHA.1564@TK2MSFTNGP06.phx.gbl... > <asp:TextBox ID="txtPriority" runat="server" > Enabled="false"></asp:TextBox> Mark Rae [MVP] wrote:
> "Axel" <n@pe.com> wrote in message thats actually what I was looking for> news:e5QiT2C8JHA.1564@TK2MSFTNGP06.phx.gbl... > >> <asp:TextBox ID="txtPriority" runat="server" >> Enabled="false"></asp:TextBox> > > <asp:TextBox ID="txtPriority" runat="server" ReadOnly="true" /> > > Thanks Mark.. I think I had started with that but (I thought that) couldn't find any way to style it in CSS, so that's why I tried Enabled="false". But what I meant is readonly - so now I only need to see what attribute it sets.... surprise,surprise its called "readonly". I think I didn't find that the first time around as I have similarly named textbox controls in a collapsible expander at the top of the page an i must always have looked at that in browser source code d'oh. :-) thanks again!! Axel Mark Rae [MVP] wrote:
> "Axel" <n@pe.com> wrote in message this is a question about a standard Textbox (dragged from the Standard > news:ua8oz1$7JHA.1568@TK2MSFTNGP06.phx.gbl... > >> I know I can set my form's textboxes ReadOnly property to disable >> them, but how can I "lock" them instead? THe user still needs to be >> able to select the text in them so they can paste it if needed. (I >> think this used to be possible in VB, how can I do it in C#)? > > Is this a WinForms or WebForms question...? > > Hi Mark, Toolbox menu). Sorry, I am a C# newbie so I don't know about WinForms or WebForms, but I hope that answers your question (?) Actually need to rephrase my original question .... so they can copy it (to the clipboard) ... (instead of paste) thanks in advance Axel
Other interesting topics
isnull ! gives error
Is there a way to keep the StreamWriter open? Web Deployment Project - Include Files Movenext and ASP.net enum or static class Hide TemplateField Sharing the Cache between ASP.NET applications SQL setup for Session Load type error Datacontext object ie8 javascript "new function" behavior |
|||||||||||||||||||||||