Drag&Drop Grouping Animation Not Working - asp.net

I enabled grouping on my RADGrid, but when I Drag & Drop a column, all I see is a "CrossHair" cursor while dragging. I do not see the animation visually showing a box representing the column being dragged, nor do I see the "double arrow" that appears showing you where the column is about to be dropped. Both these features I saw on the Telerik RADGrid Demo's, but I can seem to replicate this feature on my own RADGrid.
Help!

try the following link. This will help you getting the drag n drop working.
Iam using this method currently, too. My DNN is Version 6.x
http://www.telerik.com/community/forums/aspnet-ajax/grid/unknown-server-tag-telerik-griddragdropcolumn.aspx
*EDIT:
Call the following method in your Page_Load (this is only to get the script block dynamically on the page. You have to to the described steps in my link, too):
public void subDragDropJavaScript()
{
// define the script string to add to the page
StringBuilder sJavaScript = new StringBuilder();
// js header
sJavaScript.Append(("<script type=\'text/javascript\'>" + "\r\n"));
sJavaScript.Append("function startRowDrag_ModuleID_"+ this.ModuleId + "_GridID_" + oDNNGrid.ID + "(row, args)" + "\r\n");
sJavaScript.Append("{" + "\r\n");
sJavaScript.Append("var target = args.target || args.srcElement;" + "\r\n");
sJavaScript.Append("if (target.className.indexOf('rgDrag') > -1)" + "\r\n");
sJavaScript.Append("{" + "\r\n");
sJavaScript.Append("args._isDragHandle = true;" + "\r\n");
sJavaScript.Append("var tableView = $find(row.id.split('__')[0]);" + "\r\n");
sJavaScript.Append("var grid = $find(tableView.get_owner().get_id());" + "\r\n");
sJavaScript.Append("tableView.get_dataItems();" + "\r\n");
sJavaScript.Append("$find(row.id).set_selected(true);" + "\r\n");
sJavaScript.Append("var origFunc = Telerik.Web.UI.RadGrid.prototype._canRiseRowEvent;" + "\r\n");
sJavaScript.Append("Telerik.Web.UI.RadGrid.prototype._canRiseRowEvent = function ()" + "\r\n");
sJavaScript.Append("{" + "\r\n");
sJavaScript.Append("var el = arguments[0].target || arguments[0].srcElement;" + "\r\n");
sJavaScript.Append("return origFunc.apply(grid, arguments) || el.tagName.toLowerCase() == 'img';" + "\r\n");
sJavaScript.Append("}" + "\r\n");
sJavaScript.Append("grid._mouseDown(args);" + "\r\n");
sJavaScript.Append("Telerik.Web.UI.RadGrid.prototype._canRiseRowEvent = origFunc;" + "\r\n");
sJavaScript.Append("}" + "\r\n");
sJavaScript.Append("}" + "\r\n");
sJavaScript.Append("function gridRowDragStarted_ModuleID_" + this.ModuleId + "_GridID_" + oDNNGrid.ID + "(sender, args) {" + "\r\n");
sJavaScript.Append("if (!args.get_domEvent()._isDragHandle) {" + "\r\n");
sJavaScript.Append("args.set_cancel(true);" + "\r\n");
sJavaScript.Append("}" + "\r\n");
sJavaScript.Append("}" + "\r\n");
// js close block
sJavaScript.Append("</script>");
// add js block to page
this.Page.ClientScript.RegisterStartupScript(typeof(string), "DragnDropRowSelection_" + ModuleId, sJavaScript.ToString());
}
best regards,
noone

I know this is an old thread but I just recently found my answer.
In the Module.css of my custom module, I added the following code:
.RadGrid
{
z-index: 1000;
}
Apparently the default.css of the DNN framework makes the z-index of the module higher than the grid, which covers up the animation. Increasing the z-index to the grid itself places it above the module and thereby allows the animation to display once again.

Related

Change asp message box header / title

How can I change the title of my message box
Here is my code-behind:
string myStringVariable1 = string.Empty;
myStringVariable1 = "Policy Number:" + " " + txtPolNo.Text.ToString() + " " + "with Issuance office:" + " " + dropIssOff.Text.ToString() + " " + "was not found on the database. Please make sure that your inputs are correct.";
ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + myStringVariable1 + "');", true);
No, You can't change that title. Alternatively you can use the jQuery alert/dialog box to achieve the same.

embed image to body in html email in asp.net

How shall i write the code to embed image to email body? whats wrong?
mMailMessage.Body += Server.MapPath(#"<img src=""/Styles/Images/logo.png""");
.
You are mapping a path to a file called "<img src=""/Styles/Images/logo.png"""!
What you want to do is something like this:
mMailMessage.Body += "<img src=\"" + Request.Url.Scheme + "://" + Request.Url.Host + ":" + Request.Url.Port + #"/Styles/Images/logo.png" + "\"/>";

Error converting HTML text to a pdf file using itextsharp in asp.net

I am using the following code to convert contents in Editor(Ajax control) to pdf,
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using iTextSharp.text.html.simpleparser;
using iTextSharp.text;
using iTextSharp.text.pdf;
using iTextSharp.text.html;
/// <summary>
/// Summary description for pdfgeneration
/// </summary>
public class pdfgeneration
{
public pdfgeneration()
{
//
// TODO: Add constructor logic here
//
}
public void pdfgenerator(String name1, AjaxControlToolkit.HTMLEditor.Editor Editor1)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = "application/pdf";
// Create PDF document
Document pdfDocument = new Document(PageSize.A4, 70, 55, 40, 25);
PdfWriter wri = PdfWriter.GetInstance(pdfDocument, new FileStream("e://" +name1 + ".pdf", FileMode.Create));
PdfWriter.GetInstance(pdfDocument, HttpContext.Current.Response.OutputStream);
pdfDocument.Open();
string htmlText = Editor1.Content;
System.Collections.Generic.List<IElement> htmlarraylist = HTMLWorker.ParseToList(new StringReader(htmlText), null);
for (int k = 0; k < htmlarraylist.Count; k++)
{
pdfDocument.Add((IElement)htmlarraylist[k]);
}
pdfDocument.Close();
HttpContext.Current.Response.End();
}
}
I am initially hard coding the following HTML text in the Editor(Ajax control),
String editorcontent = "<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>" +
"<br/>" + "<P align='center'><b>" + courtname + "</b></P>"
+ "<br/><P align='center'>(Before" + jname + "," + desname + ")"
+ "<br/>" + "<P align='right'><b><u>" + DropDownList1.SelectedItem + " no. " + TextBox1.Text + "/" + TextBox2.Text + "</u></b> </P>"
+ "<br />"
**//this table is the problem//** + "<table><tr><td width='750px'><p align='left'>" + petitioner + "</p>" + "</td><td>" + "<p align='right'>" + "..Applicant" + "</p>" + "</td></tr>" + "<tr><td><p align='center'>" + "V/s" + "</p>" + "</td><td></td>" + "</tr>" + "<tr><td width='75px'><p align='left'>" + respondent + "</p>" + "</td><td>" + "<p align='right'>" + "..Respondent" + "</p>" + "</td></tr></table>"
+ "<br/><P align='center'><b><u>ORDER</u></b>";
Editor1.Content = editorcontent;
If i remove the following table from the above code than the pdf is generated successfully. but once i include that table in my HTMl code i get the following Error
How to resolve my problem.
the current version of iTextSharp does not support cell width specified with 'px'. it does support percentage or numeric-only width cell widths.
when you tried hard-coding the HTML content, there was 'px' in two places:
<td width='750px'>
<td width='75px'>
remove 'px' and you'll be OK.

email hyperlink in MailMessage

I'm using the following as part of sending a .net 4 email. I'd like to show the reply to text as an email hyperlink but can't quite get the format correct.
nMail.Body = Description " + txtdescription.Text +
"<br />Reply to (click here):" + txtemail.Text);
Wrap the address in an anchor tag <a> to make a link. Also make sure you encode the input.
Use HttpUtility.HtmlEncode on text and Uri.EscapeUriString on links.
nMail.Body = "Description " +
HttpUtility.HtmlEncode(txtdescription.Text) +
"<br />Reply to <a href=\"mailto:" +
Uri.EscapeUriString(txtemail.Text) +
"\">" +
HttpUtility.HtmlEncode(txtemail.Text) +
"</a>");
Use the following if the e-mail address is contained in txtemail.Text. Remember to first validate the content of txtemail.Text. The output of the following is a hyperlink to an e-mail address that also contains the e-mail address as the hyperlink text.
nMail.Body = "Description " + txtdescription.Text + "<br />Reply to (click here): " + "<a href='mailto:" + txtemail.Text + "'>" + txtemail.Text + "</a>");
You can write <a href='mailto:username#example.com'>Link Text</a>.
Try this
private string BuildEmailText(string description, string replyToAddress, string replyToText)
{
return string.Format("{0} <a href='{1}'>{2}</a>", description, replyToAddress, replyToText);
}

Error while sending mail (attachment file)

in my application i am using to send mail with attachments i write the code like this
Using System.Net.Mail;
MailMessage mail = new MailMessage();
mail.Body = "<html><body><b> Name Of The Job Seeker: " + txtName.Text + "<br><br>" + "The Mail ID:" + txtEmail.Text + "<br><br>" + " The Mobile Number: " + txtmobile.Text + "<br><br>" + "Position For Applied: " + txtPostionAppl.Text + "<br><br>" + "Description " + txtdescript.Text + "<br><br></b></body></html>";
mail.From = new MailAddress ( txtEmail.Text);
mail.To .Add (new MailAddress ( mailid));
mail.Priority = MailPriority.High;
FileUpload1.PostedFile.SaveAs("~/Resume/" + FileUpload1.FileName);
mail.Attachments.Add(filenme);
SmtpMail sm = new SmtpMail();
sm.Send(mail);
it is giving error at attachment like mail.Attachemts.Add(filena)
like this
'System.Collections.ObjectModel.Collection.Add(System.Net.Mail.Attachment)' has some invalid arguments.
Your syntax is wrong. See this article for the correct syntax,
http://www.systemnetmail.com/faq/2.3.aspx
You can't add an attachment simply by specifying the filename. You have to specifically create an attachment object and add that. (as shown in the linked article.)
like this:
mail.Attachments.Add(new Attachment(filename));

Resources