ASP.NET Rich Text Box gives error - c#

Im working on a web app here in C# and I have a listview. When I do an edit on the listview everything works great. In my notes field its a textbox, Id rather have it larger like a Richtextbox, but when I put that in there I get an error, other than label or textbox I cant seem to do anything. How can I make the notes field more like a rich text box area for a end user to edit?
Notes:
<asp:TextBox ID="NotesTextBox" runat="server" Text='<%# Bind("Notes") %>' Width="700px" />
<br />

RichTextBox is a WinForms control. It does not work in the WebForms platform. If you want a "rich text" editor, you'll have to find a third-party component that allows this type of editing.

Related

Change button text on ASPxPopupControl buttons

I am trying to change the text of ASPxPopupControl buttons (I have not written the ASPxPopupControl code myself. Those guys are long gone. :) So it's up to me). As far as I know, the ASPxPopupControl default buttons are used and if I want to change the button text I have to add code to the .aspx file. I have tried searching for an answer on the DevExpress docs and the world wide web. But could not find anything that matches my needs. I am very grateful for any ideas.
This is the buttons I am talking about:
The ASPxPopupControl code (There is an attempt to add a custom button but it does not work.):
<dxpc:ASPxPopupControl ID="someLongID" runat="server"
AllowDragging="True" ClientInstanceName="someLongID"
CloseAction="CloseButton" HeaderText="Varning!" Modal="True"
PopupHorizontalAlign="WindowCenter"
Width="300px">
<ContentCollection>
<dxpc:PopupControlContentControl ID="PopupControlContentControl3"
runat="server" Enabled="True">
<p>
<br />
</p>
<p align="right">
<input
id="Button1"
onclick="javascript:someLongID.Hide();"
type="button" value="Stäng" />
</p>
</dxpc:PopupControlContentControl>
</ContentCollection>
<HeaderStyle BackColor="#FFB6C1" />
</dxpc:ASPxPopupControl>
If you don't implement you own popup edit form, but use the built-in one, it is necessary to access the required text setting via the ASPxGridView.SettingsText (CommandUpdate, etc.).
I think you can change the text content in the item property (in "Properties") which is located in the right down corner on VS.
you can click on the item in "Design" mode and then check its setting in "Properties"
Hope this helps

AjaxControlToolkit button not work

why button of text editor for AjaxControlToolkit not working with me like
color font - size only drop down worked ok
but others one can't uses
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor" TagPrefix="cc1" %>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" />
<label class="control-label">Enter Title News</label>
<asp:TextBox ID="Title1" CssClass="form-control" runat="server"></asp:TextBox>
<br />
<label class="control-label"> Content News</label>
<cc1:Editor ID="Editor1" runat="server" />
You must use TargetControlID like that
<cc1:Editor ID="Editor1" TargetControlID="Title1" runat="server" />
I think I understood your problem.
Open this link: HTML Editor Sample
You say you try to change the font-color and background pressing the control buttons. Those buttons work when you select the text first.
Type something into the Editor, then select that text.
After that press the font-color change button. It should turn you text into another color.
It works the same way with the background.
Also, if you press the button, then star typing, your text should start showing the color. (Works exactly like Word)
problem was when page load the editor tool and when i want post content
if when i press on button there is not working like (fore color , insert link )
This problem was due to my use bootstrap because when i create new web form and include the editor it's working fine and all the buttons can press and uses
Thank you for helping me

Change the color of different lines in a textbox in codebehind?

I need to have have diffrent lines in different colors for a textbox.
I donot want to use a rictextbox.
<asp:TextBox ID="TxtMessage" runat="server" Width="550" TextMode="MultiLine" Height="242px" />
Is there any way to use some html to achieve this?
I have tried this but it doesnot work:
Txtmsg2.Text = "<span style='color: red;'>ENFIELD ONLY:</span>" & Chr(13)
This is not possible within a text area, you'll need to use a rich text box (which I see you don't want to use) or a WYSIWYG editor such as TinyMCE.

Show and hide labels with assosicatedControls and their controls

I want to show and hide a label and its control. I can do this in c# in the code behind. But, I can only show/hide the control. Any ideas?
<asp:label AssociatedControlID="thisLabel" runat="server">This:
<asp:label ID="thisLabel" CssClass="ascontrol" runat="server" />
</asp:label>
I want to be able to show and hide that whole thing depending on what user gets to the page. I just need to know how to show/ hide that whole thing in the c# code behind...cannot seem to get the visibility of the wrapper label to go away.
You haven't supplied a server-side Id:
<asp:Label ID="label_MyControl" AssociatedControlID="txt_MyControl" runat="server" />
<asp:TextBox ID="txt_MyControl" runat="server" />
What you've done is nest a asp:Label control within another asp:Label control....
Since I normally hide more than one field contiguously, I tend to wrap the whole thing in an asp:Panel and hide the panel. However, that's just my particular usage. But since it's my usage, I tend to block those sorts of things out into panels even for something as simple as your example.
Just my nickel's worth, your mileage may vary, as always.
It should work if you get you r markup correct, like this:
<asp:Label ID="lblYear" runat="server" Text="Year (yyyy):"
AssociatedControlID="txtYear"></asp:Label>
<asp:TextBox ID="txtYear" runat="server" Columns="30" MaxLength="4"></asp:TextBox>
Then in the code behind you could have:
lblYear.visible = False
txtYear.Visible = False
Now, my understanding of the "AssociatedControlID" property of an asp:label is mainly for accessibility purposes. You don't need to have the AssociatedControlID value set to make things work as I've shown.

Anyway to dynamically set text in an asp:FileUpload?

When the user selects an item from a dropdownlist containing image names, I would like the FileUpload text box to be filled with a message I program such as "Replace this image with..." How would I do this?
Security restrictions in certain browsers (IE at least) prevent you from being able to actually set the text of an <input type="file" /> element, which is what the FileUpload ASP.NET control renders.
I am on a project where we are trying to manipulate the appearance of file upload elements, and it's proving to be quite difficult to do in a cross-browser-compliant manner. I suggest looking at flash-based solutions such as Uploadify, which is more customizable.
Due to the nature of the control, for security reasons you cannot manipulate it beyond some styling.
What you can do, however, is use a Flash or Silverlight based upload control. Or put your desired message in a label above the file input.
Not possible. The < input type="file" /> is part of the browser chrome. Some browsers don't show any text at all, so any solution would not be robust. As Bryan suggests, use a < label >.
Like others have said, there is no way to directly change the text of the file name box, but what you can do is create a label and use positioning to make sure the label appears directly above the uploader.
<span runat="server" id="SelectedFileSpan" style="position: absolute; top: 10px; left: 12px">
<asp:Label runat="server" ID="FileNameLabel"></asp:Label>
</span>
<asp:FileUpload runat="server" ID="FileUploader" />
Then set the text of the label.

Categories

Resources