|
It entirely depends on what you want to build, what framework you are using and how much do you know about a Rich Text Box. Since, you have asked this under ASP.NET, I can tell you that HTML can be used to build a basic RichTextBox here,
<div contenteditable="true">
Some content here, it can be edited with the support of CTRL B and CTRL I modifiers.
</div> You can try that code in any online fiddle, and see that the element would allow users to modify the content, through the use of CTRL + B and CTRL + I etc. Secondly, in ASP.NET there are some built-in text boxes, but they are not rich one, thus you would require to use a third-party, Rich Text box in asp.net | The ASP.NET Forums. It depends on how much effort you want to put into this project of yours.
As I mentioned, if you want to build a complex text editor, consider using one of the famous text editors out there instead of building your own text editor — rich text editors, and text editors online are quite similar, Google WYSIWYG for instance; TinyMCE | The Most Advanced WYSIWYG HTML Editor.
Making content editable - Web developer guides | MDN
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Hey guys, as of recent i have been learning ASP so i can create a web application for an existing SQL database. I'm just wondering how i could go about creating user login/logout , sessions , profile page , and registration pages. Im developing in visual studio community 2017.
Thanks.
|
|
|
|
|
Go to ASP.NET | The ASP.NET Site[^] where you will find plenty of tutorials and samples. For anything you do not find you should use Google.
|
|
|
|
|
Hello again.
This is the last installment of my project.
was using Gridview1_RowDeleting with similar code below to delete a dynamically generated row.
That worked great.
Now, I am trying to use the code below to accomplish similar function only this time, with Repeater control.
I can't get past int rowID = e.RowIndex.
Any ideas how to work around this?
Markup:
<asp:Button ID="btnDelete" runat="server" Width="70"
Text="Remove" CommandName="Remove"
CommandArgument='<%# Container.ItemIndex %>' />
I have also tried this:
sp:Button ID="btnDelete" Style="width: 120px;" runat="server" Text="Remove a row"
OnClick="btnDelete_Click" CssClass="btnclass" />
C#
otected void btnDelete_Click(object sender, EventArgs e)
{
int rowIndex = 0;
int rowID = e.RowIndex;
lblTotal.Text = "0";
if (ViewState["CurrTable"] != null)
{
DataTable dtCurrentTable = (DataTable)ViewState["CurrTable"];
if (dtCurrentTable.Rows.Count > 0)
{
for (int i = 1; i <= Repeater1.Items.Count; i++)
{
TextBox tbboatregNum = (TextBox)Repeater1.Items[rowIndex].FindControl("txtboatregNum");
TextBox tbPayerret = (TextBox)Repeater1.Items[rowIndex].FindControl("txtPayerret");
TextBox tbCGvesselNum = (TextBox)Repeater1.Items[rowIndex].FindControl("cgaurdNumber");
TextBox tbCGtaxpayerret = (TextBox)Repeater1.Items[rowIndex].FindControl("cguardreturnedval");
dtCurrentTable.Rows[i - 1]["boatregNum"] = tbboatregNum.Text;
dtCurrentTable.Rows[i - 1]["taxpayerret"] = tbPayerret.Text;
dtCurrentTable.Rows[i - 1]["CGvesselNum"] = tbCGvesselNum.Text;
dtCurrentTable.Rows[i - 1]["CGtaxpayerret"] = tbCGtaxpayerret.Text;
rowIndex++;
}
if (e.RowIndex < dtCurrentTable.Rows.Count)
{
dtCurrentTable.Rows.Remove(dtCurrentTable.Rows[rowID]);
}
}
ViewState["CurrTable"] = dtCurrentTable;
Repeater1.DataSource = dtCurrentTable;
Repeater1.DataBind();
}
SetPreviousData();
}
Many thanks in advance
|
|
|
|
|
Where have you seen that EventArgs has an RowIndex property?
The moment you moved from Grid to Repeater you lost all the help. Repeater does not maintain a table-like structure, every block created from the template stands on its own...
That's the reason you have to pass identifying parameters to the template, like CommandArgument='<%# Container.ItemIndex %>'... Use that to find the row to remove!
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Kornfield,
Thanks for your response.
Just so I understand your point, you are saying that if I use the following:
sp:Button ID="btnDelete" runat="server" Width="70"
Text="Remove" CommandName="Remove"
CommandArgument='<%# Container.ItemIndex %>' /> ,
then I would be able to use the C# with rowIndex as is?
|
|
|
|
|
No!!!
What I'm saying, that you have no way to use a property that does not exist on the object, but you can fill in the gap by passing the value on the CommandArgument property of the button initiated the event...
So instead of e.RowIndex you can use btnDelete.CommandArgument...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
I have figured it out.
Thank you.
|
|
|
|
|
Hi
I ran the fortify scan to see if we have any vulnerabilities and found some of them wrt cross site scripting poor validation on the .aspx pages. Tried the below following methods to solve but still Fortify shows as vulnerability.
Here's my code.
<asp:label id="lblCsf" runat="server" text="<%# AntiXss.AntiXssEncoder.HtmlEncode(Eval("Max").ToString, True) %>">
<asp:label id="lblCsf" runat="server" text="<%# HttpUtility.HtmlEncode(Eval("Max")) %>">
Appreciate if any of you can suggest some solution for this scenario.
|
|
|
|
|
|
Thanks for your response, but initially it was : and since fortify was showing as cross site vulnerability so I have changed to use AntiXss. But still it shows the same vulnerability. The only difference was while using : , it says Cross site vulnerability and when using AntiXss, it says Poor cross site vulnerability.
|
|
|
|
|
Still sounds like a bug in Fortify to me.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi,
I am facing same issue.
Did you find any solution for this?
Thanks
|
|
|
|
|
Hi,
I am creating a ASP.Net, Web Api web application which I am planning to use mostly the Web Api for the Business and Data Access calls, trying to avoid the MVC Controllers, as I am mostly using Web Api calls and Web Api doesn't support Sessions, what I am trying to do is to keep/pass Session values as hidden fields in html pages. And in every call those values will be passed to the Web Api methods and back to the UI to be stored in the Hidden fields.
My question is, is this a good approach or very bad approach, if its bad approach can you please guide me what are the alternative good approaches. I am not familiar much with the ASP.Net MVC, I was very good in WebFarms sometime back, trying my best to come out of that old thinking bros, need some help.
Thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
|
Hi Friends,
we are facing issue in website goes down in frequently, starting to working on after recycling app pool.
Configuration and technology:
windows server 2008 standard IIS 7
Website developed in asp.net 1.1
please provide resolution if you guys knowing or experienced the same.
Advance wishes!!!
|
|
|
|
|
The application code running that particular site is throwing an un-handled exception and is locking up the process until it is reset (recycled). Check the event viewer, you will likely find some .NET errors lodged in there.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Hi,
I am trying to create modal dialog which contains Text-boxes and drop-downs which are going to get the Data from the parent page, but its not creating the modal dialog but its putting the values on the same parent page. Here is how I have created the modal
$('#btnViewJob').click(function (event) {
var mytext = 'My first modal dialog using MVC: <input type="text" value="Some value comes from parent page" id="temp"' + somevaluecomesfromparentpage + '" />';
$('<div id="dialog"><table><tr><td>' + mytext + '</td></tr></table></div>').appendTo('body');
event.preventDefault();
$('#dialog').dialog({
autoOpen: false,
width: 400,
resizable: false,
title: "hi there",
modal: true,
buttons: {
"Close": function () {
$(this).dialog("close");
}
}
});
});
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
You've specified autoOpen:false , so the first time you click the button, the dialog is created but never shown.
The next time you click the button, you create a new <div> with the same ID, and append it to the body. IDs are supposed to be unique, so the #dialog selector only returns the first element with that ID. Since the dialog(...) call is what hides the element, the subsequent elements are never hidden, and appear at the end of the body.
You need to change the code so that it uses the existing element on subsequent clicks:
$('#btnViewJob').click(function(event) {
event.preventDefault();
var mytext = 'My first modal dialog using MVC: <input type="text" value="Some value comes from parent page" id="temp"' + somevaluecomesfromparentpage + '" />';
var dialog = $("#dialog");
if (!dialog.length) {
dialog = $("<div/>").attr("id", "dialog").appendTo("body");
dialog.dialog({
autoOpen: false,
width: 400,
resizable: false,
title: "hi there",
modal: true,
buttons: {
"Close": function() {
$(this).dialog("close");
}
}
});
}
dialog.empty().html("<table><tr><td>" + mytext + "</td></tr></table>");
dialog.dialog("open");
});
Demo[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
But for my its is saying Uncaught TypeError: dialog.dialog is not a function, anything can I do to avoid this buddy?
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Have you included the jQuery UI scripts?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
In registerbundles I have written this:
bundles.Add(new StyleBundle("~/Content/themes/bsc/css").Include(
"~/Content/themes/bsc/jquery-ui.min.css",
"~/Content/themes/bsc/jquery-ui.structure.min.css",
"~/Content/themes/bsc/jquery-ui.theme.min.css"));
And in the cshtml, I have written like below:
@section head{
@Styles.Render("~/Content/css")
@Styles.Render("~/bundles/bootstrap")
@Styles.Render("~/bundles/jquery")
@Styles.Render("~/bundles/jqueryval")
@Scripts.Render("~/bundles/jqueryui")
@Scripts.Render("~/Content/themes/bsc/css")
}
And in the .js file I have written as below:
$('#btnViewJob').click(function (event) {
event.preventDefault();
var mytext = 'My first modal dialog using MVC: <input type="text" value="Some value comes from parent page" id="temp" />';
var dialog = $("#dialog");
if (!dialog.length) {<br />
dialog = $("<div/>").attr("id", "dialog").appendTo("body");
dialog.dialog({
autoOpen: false,
width: 400,
resizable: false,
title: "hi there",
modal: true,
buttons: {
"Close": function () {
$(this).dialog("close");
}
}
});
}
dialog.empty().html("<table><tr><td>" + mytext + "</td></tr></table>");
dialog.dialog("open");
});
In the css I have written like below:
table#tableDisplay2 {
border-collapse: collapse;<br />
}
<h1>tableDisplay2 th {</h1>
<pre>
background-color: #eee;
border-top: 1px solid #fff;
}
tableDisplay2 tr:hover {
background-color: #ccc;
}
tableDisplay2 tr::selection {
background-color: #ccc;
}
tableDisplay2 tr.selected { background-color:#ccc !important; }
tableDisplay2 td:hover {
cursor: pointer;
}
CSS part is working fine it is changing the color of the table row when selected, but only thing is when button clicked, its not opening the new modal dialog, and giving the same error that is: Uncaught TypeError: dialog.dialog is not a function. Any help my friend?
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
What about the style bundle for "~/bundles/jqueryui" ?
Also, view the source of the page to make sure the jQuery UI scripts are included, and click on the link to make sure they're loading properly.
And are you using the full jQuery UI library, or a custom download? It's possible that you've got a version that doesn't include the dialog widget.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Yes I have that in my register bundles method:
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
I saw the ViewSource only thing is, jquery-ui is loading two times, can it be a problem, here is how it looking in the header section of the page:
<script src="/BSCSecurityAddressBookWeb/Scripts/jquery-ui-1.11.4.js"></script>
<script src="/BSCSecurityAddressBookWeb/Scripts/jquery-ui-1.12.1.js"></script>
<script src="/BSCSecurityAddressBookWeb/Scripts/jquery-ui-1.12.1.js"></script>
<script src="/BSCSecurityAddressBookWeb/Content/themes/bsc/jquery-ui.min.css"></script>
<script src="/BSCSecurityAddressBookWeb/Content/themes/bsc/jquery-ui.structure.min.css"></script>
<script src="/BSCSecurityAddressBookWeb/Content/themes/bsc/jquery-ui.theme.min.css"></script>
My Register Bundle Config method is as below, is there any possibility I am missing anything in it?:
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new ScriptBundle("~/bundles/layout").Include(
"~/Scripts/Shared/Layout.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/employee").Include(
"~/Scripts/Employee/Index.js",
"~/Scripts/Employee/Employee.js"));
bundles.Add(new ScriptBundle("~/bundles/multijobchange").Include(
"~/Scripts/MultiJobChange/Index.js",
"~/Scripts/MultiJobChange/MultiJobChange.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css",
"~/Content/AppCss.css",
"~/Content/css/CustomStyles.css"
)
);
bundles.Add(new StyleBundle("~/Content/themes/bsc/css").Include(
"~/Content/themes/bsc/jquery-ui.min.css",
"~/Content/themes/bsc/jquery-ui.structure.min.css",
"~/Content/themes/bsc/jquery-ui.theme.min.css"));
}
still its giving me the same error what else could it be buddy?
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
-- modified 9-Aug-17 18:17pm.
|
|
|
|
|
It's included three times (two different versions) and yes that's a problem, you need to make sure only one version is referenced. Make sure you don't have copies of multiple versions in your scripts folder then try and work out where other duplicate references are coming from.
|
|
|
|
|