Change asp message box header / title - asp.net

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.

Related

How to add newline within one radio button control in VB

UPDATE: (working code attached)
I remove the NewLine / Environment.NewLine, and replaced them by adding <br/> in the "Session :",
which meant by "<br/> Session :", worked like a charm! Thanks #nelek
With rdlSession.Items
.Add("Session :" + session.ToString() + Environment.NewLine + _
"Date :" + day.ToString() + vbNewLine + _
"Coach :" + coach.ToString() + vbNewLine + _
"Available slot :" + slot.ToString())
End With
How to arrange them into four rows instead of bulking up within one row?
They are one of my options in radiobuttonlist. I have tried using Environment.Newline , vbNewline , NewLine.
Is there any possible way to make it?
UPDATE: (working code attached)
I remove the NewLine / Environment.NewLine, and replaced them by adding <br/> in the "Session :",
which meant by "<br/> Session :" and it worked like a charm! Thanks #nelek

Drag&Drop Grouping Animation Not Working

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.

asp.net GridView and Checkboxes Dynamic Bind

I am having a little issue that I don't seem to understand the best way to approach.
I have a GridView that get automatic column generations based on the query I run. The GridView will contain (Name) (Description) (Edit) (Delete) (View) (Admin).
Now because the Edit, Delete, View... are bit's in the database when the query returns the results and binds the data with the GridView I get these grayed out Checkboxes with checked if True or Unchecked if False.
Now because I didn't create those disabled checkboxes are they really a checkbox or are the something that's just display like that... If they are really a checkboxes how do I access them and enable or disable them? I tried looping through each cell in grid but when I say cell.text it gives me empty string back... What would be the best way to approach this or am I misunderstanding the DataBind of a bit fields?
Thanks all for your help.
UPDATED
string sSQLAccess = "SELECT ap.n_Name 'App', a.b_Edit 'Edit', a.b_Delete 'Delete', a.b_View 'View' " + Environment.NewLine
+ "FROM tbl_Actions a " + Environment.NewLine
+ "JOIN tbl_Applications ap ON ap.u_ID = a.u_ApplicationID" + Environment.NewLine
+ "JOIN tbl_Roles r ON r.u_ID = a.u_RoleID" + Environment.NewLine
+ "WHERE a.b_Deleted = 0" + Environment.NewLine
+ "AND ap.b_Deleted = 0 " + Environment.NewLine
+ "AND r.b_Deleted = 0 " + Environment.NewLine
+ "AND a.u_RoleID = '" + Request.QueryString["ID"] + "'" + Environment.NewLine;
grdAccess.DataSource = vwAccess;
grdAccess.DataBind();
The checkbox will not be enabled unless the gridview is in edit mode - you would need to define an edit template for the gridview.

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