|
I did my own research, tinkering and programming, according to you in addition to FCKeditor and CKeditor, currently the programming tool supports better than CKeditor what tool do you use ?
|
|
|
|
|
I'm not sure what you mean by tool.
I used both, starting with FCKEditor and then CKEditor in a Asp.Net Webform app.
I got as far as writing JS files to program the editor, JS scripts to load the HTML, get the HTML back, and wrote
Custom tools or controls to ...
Upload new images,
Set images from the Product database
Place images and text,
Load custom HtmlTemplates to showcase products
Load custom HTML sections
I got pretty good with CKEditor and customers liked it. But I haven't touched it in 3 years, I dropped Webforms and went Angular now.
I think this is what your looking for. It took me a long time to understand how to save the HTML in the editor without reloading the form, and saving when posting the entire form back to the server. It's JQuery, that can write to input elements on the webform. This file calls functions in the main ckEditor JS file. I don't remember all the details to CKEditor, but I needed a JavaScript interface to write the HTML in the content container to a textbox or input form element, since the ckEditor container is not a form element.
So you create a form element that represents the CKEditor HTML content data, and create sort of a hook to go back and forth to ckEditor object, and a panel/container to hold the CKEditor JavaScript object inside.
The function is tied to a webform button OnClientClick(update_ckEditor_Preview())
function update_ckEditor_Preview() {
var ckEditor_XHTML, ckEditor_Instance, ckEditor_Update, classic_template;
classic_template = $('[id*="_txt_ProductEditor_Template"]').val();
try {
var ckInstance = ckEditor_GetInstance();
if (ckInstance !== null) {
var ckDirty = ckInstance.checkDirty;
ckEditor_XHTML = ckInstance.getData();
ckEditor_Instance = ckInstance.getData();
if (ckDirty) {
ckInstance.resetDirty();
}
$('[id*="_panel_Display_Classic_XHTML"]').empty();
$('[id*="_panel_Display_Classic_XHTML"]').append(ckEditor_XHTML);
$('[id*="_panel_Display_Classic_XHTML"]').css('display', 'inline-block');
ckEditor_Update = true;
}
else {
ckEditor_XHTML = $('[id*="_ck_Editor_ProductXHTML"]').val();
$('[id*="_panel_Display_Classic_XHTML"]').empty();
$('[id*="_panel_Display_Classic_XHTML"]').append(ckEditor_XHTML);
$('[id*="_panel_Display_Classic_XHTML"]').css('border', 'solid 1px rgb(28,134,238)');
ckEditor_Update = true;
}
}
catch (err) {
$('[id*="_panel_ProductEditor_Basic_Image_UpdateMessage"]').css('background-color', 'rgb(176,23,31)');
$('[id*="_panel_ProductEditor_Basic_Image_UpdateMessage"]').fadeIn('normal', function () {
$('[id*="_lbl_ProductEditor_Basic_Image_UpdateMessage"]').text("Could not connect to the ckEditor interface, update has failed");
});
}
if (true === ckEditor_Update) {
$('[id*="_panel_ProductEditor_Basic_Image_UpdateMessage"]').css('background-color', 'rgb(28,134,238)');
$('[id*="_lbl_ProductEditor_Basic_Image_UpdateMessage"]').text("Preview Display Page has been updated successfully");
$('[id*="_panel_ProductEditor_Basic_Image_UpdateMessage"]').fadeIn('normal').delay(5000).fadeOut('normal');
}
else {
$('[id*="_panel_ProductEditor_Basic_Image_UpdateMessage"]').css('background-color', 'rgb(176,23,31)');
$('[id*="_lbl_ProductEditor_Basic_Image_UpdateMessage"]').text("Could not connect to the ckEditor interface, update has failed");
$('[id*="_panel_ProductEditor_Basic_Image_UpdateMessage"]').fadeIn('normal').delay(5000).fadeOut('normal');
}
return false;
}
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
|
Well that solves linking a textbox to ckEditor and having to write JavaScript.
I didn't want to download your image.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Why have you replied to me instead of the OP?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: instead of the OP? Maybe he's not down with OPP?
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Good question. It wasn't intentional.
Perhaps lack of sleep, woke up at 4:30 and could not go back to sleep, so I went to work.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I know how to get it in Startup, but I wrote a class that seeds the database with values, and expanded it to write the product images to wwwroot from the database called SeedDatabase. I just need the wwwroot so I can write the images to the right place.
Guess I figured it out...
Amazing, had no idea this would work, well in development at least.
So I can request services from startup? That's my new question.
private static void SeedDatabase(IWebHost host, Settings appSettings, bool isDocker, string env)
{
using (var scope = host.Services.CreateScope())
{
var services = scope.ServiceProvider;
var logger = services.GetRequiredService<ILogger<Program>>();
var environment = services.GetService<IHostingEnvironment>();
logger.LogInformation("DbAuthConnection=" + appSettings.MongoDB.Connection);
logger.LogInformation("DbAuthContainer=" + appSettings.MongoDB.Container);
logger.LogInformation("Environment=" + env);
try
{
DbInitializer.SeedData(appSettings, environment, isDocker);<br />
logger.LogInformation("Seed DB Succeeded:" + DateTime.Now);
}
catch (Exception ex)
{
logger.LogError(ex, "Seed DB Failed on " + DateTime.Now + ":" + ex.Message);
}
}
}
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I have been struggling with this problem for some time. What I need to to identify when this is True.
<p
id="noWorkopportunities" class="text-info" style="display:none;">
No available work opportunities found.
/p>
Here is my source and code. Thank You!!
Jim
<div class="panel panel-primary" style="margin-top:10px;">
<div class="panel-heading">
Work Opportunities Available
</div>
<div class="panel-body">
<img id="pw_workopportunities" src="/Images/pleaseWait.gif" alt="Please Wait" style="margin-left:10px" />
<p id="noWorkopportunities" class="text-info" style="display:none;">
No available work opportunities found.
</p>
<table id="workopportunities" style="display:none;" class="table table-bordered">
<tr>
<th>Project Name/Work Order</th>
' Get all tables in the document
Dim tables As HtmlAgilityPack.HtmlNodeCollection = main.DocumentNode.SelectNodes("//table") <b><---- this statements successfully gets all the tables</b>
Dim rows As HtmlAgilityPack.HtmlNodeCollection = main.DocumentNode.SelectNodes("//p[@id='noWorkopportunities'") <b><---I get an error/nothing</b>
' Iterate all rows in the first table
For k = 0 To rows.Count - 1
-- modified 11-Jan-20 11:47am.
|
|
|
|
|
I am trying to send email using the EmailButton_Click code. However I am getting the error on this line smtp.Send(mailMessage)
The error is System.Net.Mail.SmtpException: 'Cannot get IIS pickup directory.'
Can someone help me fix it please?
protected void EmailButton_Click(object sender, EventArgs e)
{
EmailButton.Visible = true;
string requestor = RequestorDropDownList.SelectedValue.ToString();
string message = "The following records have been prepped for processing. Valid cases will be processed.";
if (requestor.Length > 0)
message = string.Format(message);
using (MailMessage mailMessage = new MailMessage())
{
mailMessage.From = new MailAddress("NoReply_FTA@courts.state.mn.us");
MailAddress to = new MailAddress(requestor);
mailMessage.To.Add(to);
string ccEmailAddress = "okaymy1112@mail.com";
if (ccEmailAddress.Length > 0)
{
MailAddress ccto = new MailAddress(ccEmailAddress);
mailMessage.CC.Add(ccto);
}
mailMessage.Subject = "FTA Case Reset Notice";
mailMessage.Body = message;
SmtpClient smtp = new SmtpClient();
smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
smtp.Send(mailMessage);
}
string msg = "No batches were found";
Response.Write("<script>alert('" + msg + "')</script>");
}
|
|
|
|
|
This is much the same issue as you posted a couple of days ago below at How to I make EmailButton_Click work? - ASP.NET Discussion Boards[^], and you appear to be trying to learn how to make it work by posting questions one at a time. Can i suggest that you study the SMTP documentation more closely to see exactly how you should be using these features. If you want to use PickupDirectoryFromIis then you most likely need to configure it within IIS.
|
|
|
|
|
First google result has some possible fixes, https://stackoverflow.com/questions/2190361/cannot-get-iis-pickup-directory
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
I have a foreach statement. When I run my code in debug mode, I am getting the following error. I am not sure how to fix it. Google search shows may ways of doing it.
Error:
'object' does not contain a definition for 'Value' and no accessible method 'Value' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
My code behind
foreach(string caseNumber in userEnteredCaseNumberList)
{
EditCandidateCaseModel newCandidate = new EditCandidateCaseModel();
newCandidate.CaseNbr = caseNumber;
newCandidate.RequestorInfoID = requestorItem.Value;
newCandidate.BatchNumber = newBatchNumber;
newCandidate.EntryStaffUserName = this._loggedInUserName;
await CandidateCaseController.PostCandidate(newCandidate);
}
|
|
|
|
|
requestorItem does not have a property named Value. That's all the error is telling you.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
I am writing a small example of Login webSite, there are two types of accounts and passwords, one is an account and password is stored in the Web.config file and the other two accounts and passwords are saved in SQL Server database, My problem is that in form 1, when logging in it opens Logon_Redirect.aspx file but cannot access, the following is my code
I am debugging and running to the code where this opens the Logon_Redirect.aspx file but nothing, but when I log in with another account and password (the user password of SQL Server) log in well.
In file Web.config
<appSettings>
...
<add key="SmtpServer" value="localhost"/>
<add key="EmailWebmaster" value="admin"/>
<add key="Password" value="123"/>
...
</appSettings>
In file Logon_Redirect.aspx
...
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
In file Logon_Redirect.aspx.cs
...
public partial class Logon_Redirect : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Page.User.IsInRole(Globals.Settings.AppRoles.KhachHang))
Response.Redirect(Globals.ApplicationPath);
else if (Page.User.IsInRole(Globals.Settings.AppRoles.Admin))
Response.Redirect(Globals.ApplicationPath + "WebMaster/Contacts/Contact.aspx");
}
}
In file Logon.aspx.cs
protected void btLogon_Click(object sender, EventArgs e)
{
if (Membership.ValidateUser(txtEmail.Text, txtPassword.Text))
{
if (Request.QueryString["ReturnUrl"] != null)
{
FormsAuthentication.RedirectFromLoginPage(txtEmail.Text, false);
}
else
{
FormsAuthentication.SetAuthCookie(txtEmail.Text, false);
Session["username"] = txtEmail.Text.Trim();
Response.Redirect(Globals.ApplicationPath + "Logon_Redirect.aspx");
}
}
else
{
if (webapp4U.BOL.User.CheckUserName(txtEmail.Text) && txtPassword.Text == ConfigurationManager.AppSettings["Password"].ToString())
{
FormsAuthentication.SetAuthCookie(txtEmail.Text, false);
Session["username"] = txtEmail.Text.Trim();
Response.Redirect(Globals.ApplicationPath + "Logon_Redirect.aspx");
}
else
lblMsg.Text = ResourceManager.GetString("Logon_False");
}
}
|
|
|
|
|
I am not sure what you want us to do. You have to debug this, we can't do it for you.
And in case you do not know, storing passwords in the web.config is not a good idea nor storing them in the db either. You should store hashes, but that's another topic for another time.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
|
What do you want us to do?
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Member 2458467 wrote: if (Page.User.IsInRole(Globals.Settings.AppRoles.KhachHang))
There's nothing in the code you've posted to show how you're loading the roles for the user.
If you're not loading the roles, then the user won't be in any roles, and your Page_Load method won't redirect at all.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
If so, why can I login the sql server's user/password ?
protected void btLogon_Click(object sender, EventArgs e)
{
if (Membership.ValidateUser(txtEmail.Text, txtPassword.Text))
{
...
}
else
{
...
}
}
|
|
|
|
|
You can log in, but in the code you've posted, you're not assigning any roles to the user.
Any calls to User.IsInRole will therefore return false .
ASP.NET 3.5 - Roles | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
You can log in, but in the code you've posted, you're not assigning any roles to the user.
Any calls to User.IsInRole will therefore return false.
ASP.NET 3.5 - Roles | Microsoft Docs[^]
I don't understand you saying "Any calls to User.IsInRole will therefore return false." Can you tell me where this is ? How do I edit the code? I debug in the button_click event code, I see
protected void btLogon_Click(object sender, EventArgs e)
{
if (Membership.ValidateUser(txtEmail.Text, txtPassword.Text))
{
try
{
if (Request.QueryString["ReturnUrl"] != null)
{
FormsAuthentication.RedirectFromLoginPage(txtEmail.Text, false);
}
else
{
FormsAuthentication.SetAuthCookie(txtEmail.Text, false);
Session["username"] = txtEmail.Text.Trim();
Response.Redirect(Globals.ApplicationPath + "Logon_Redirect.aspx");
}
}
catch (Exception ex)
{
Debug.Print("Error login sql: " + ex);
}
}
else
{
try
{
if (txtEmail.Text==ConfigurationManager.AppSettings["EmailWebmaster"].ToString() && txtPassword.Text == ConfigurationManager.AppSettings["Password"].ToString())
{
FormsAuthentication.SetAuthCookie(txtEmail.Text, false);
Session["username"] = txtEmail.Text.Trim();
Response.Redirect(Globals.ApplicationPath + "Logon_Redirect.aspx");
}
else
lblMsg.Text = ResourceManager.GetString("Logon_False");
}
catch (Exception ex)
{
Debug.Print("Error Web.config: " + ex);
}
}
}
I am debugging both the user/pass sql server and user/pass cases in the Web.config file when I came to the code "Response.Redirect (Globals.ApplicationPath +" Logon_Redirect.aspx ");" In both cases, a notification is sent to view the http://www.mediafire.com/view/wvlg2xymggvd6rj/ErrLoginFA.jpg/file attachment
When running this line with the corresponding user/pass will give an error message Debug.Print (...) corresponding to both cases. If the login user/password sql server can access, the login user/password Web.config cannot access although the login user/password sql server reports the above error via Debug.Print (..)
Error login sql: System.Threading.ThreadAbortException: Thread was being aborted.
at System.Threading.Thread.AbortInternal()
at System.Threading.Thread.Abort(Object stateInfo)
at System.Web.HttpResponse.AbortCurrentThread()
at System.Web.HttpResponse.End()
at System.Web.HttpResponse.Redirect(String url, Boolean endResponse, Boolean permanent)
at System.Web.HttpResponse.Redirect(String url)
at webapp4U.UI.Controls.Controls_MenuLeft.btLogon_Click(Object sender, EventArgs e) in c:\WebSite2010\Controls\Logon.ascx.cs:line 68
Error Web.config: System.Threading.ThreadAbortException: Thread was being aborted.
at System.Threading.Thread.AbortInternal()
at System.Threading.Thread.Abort(Object stateInfo)
at System.Web.HttpResponse.AbortCurrentThread()
at System.Web.HttpResponse.End()
at System.Web.HttpResponse.Redirect(String url, Boolean endResponse, Boolean permanent)
at System.Web.HttpResponse.Redirect(String url)
at webapp4U.UI.Controls.Controls_MenuLeft.btLogon_Click(Object sender, EventArgs e) in c:\WebSite2010\Controls\Logon.ascx.cs:line 85
|
|
|
|
|
There is nothing in any of the code you've posted that sets the roles for a user.
Computers aren't magic. If you don't tell the system that the user is in a particular role, then it doesn't have any way to know that the user is in that role. When you later ask it if the user is in that role, the only answer it can give you is "no".
Follow the link I provided in my previous message, and read about how to set up your application to support user roles.
(And you can ignore the ThreadAbortException - that's a normal part of redirecting the user to another page.)
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have a RequestorDropDownList which is populated with a list of names from a GetRequestorInfoModel.
I need help to make a change so that when this list is populated, the first name is not automatically selected until a user selects it.
How do I do this based on my code below?
ASP code for the dropdownlist
<asp:DropDownList ID="RequestorDropDownList" runat="server" Font-Size="8.25pt"
Height="20px" ToolTip="Requestor" Width="160px" SelectMethod="GetRequestorEmail"
DataTextField="DisplayName" DataValueField="Email"
OnSelectedIndexChanged="RequestorDropDownList_SelectedIndexChanged">
</asp:DropDownList>
Code behind that is populating the dropdownlist
#region Requestor dropdownlist
public async Task<IEnumerable<GetRequestorInfoModel>> GetRequestorEmail()
{
try
{
var requestors = await FTACaseReseting.Controllers.RequestorInfoController.GetAllRequestorInfoes();
return requestors.OrderBy(x => x.DisplayName);
}
catch (Exception ex)
{
string errorMsg = string.Format("An error has occured in {0}. \nException:\n{1}", "PopulateRequestorComboBox()", ex.Message);
Response.Write("<script>alert(" + HttpUtility.JavaScriptStringEncode(errorMsg, true) + ")</script>");
return Enumerable.Empty<GetRequestorInfoModel>();
}
}
#endregion
Here is code for RequestorDropDownList_SelectedIndexChanged
protected void RequestorDropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
if (RequestorDropDownList.SelectedItem ==null)
{
ListItem requestorItem = new ListItem();
requestorItem = (ListItem)RequestorDropDownList.SelectedItem;
if (requestorItem.Text.Length < 0)
{
string selectRequestor = "Please select a Requestor.";
ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + selectRequestor + "');", true);
}
this.EmailButton.Enabled = false;
RequestorDropDownList.SelectedValue = RequestorDropDownList.SelectedItem.Value;
}
}
modified 9-Jan-20 12:29pm.
|
|
|
|
|
You can add an empty item, such as one that has text "Please select..." or something like that.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|