|
Press Control,Shift and F button u will get a search window. Type usr page name u ll get all related pages![Cool | :cool:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_cool.gif)
|
|
|
|
|
I have used urlrewriting.net for url rewriting in my application.I have buttonfield in gridview as
<asp:ButtonField HeaderText="Buy" ButtonType="Image" ImageUrl="~/images/addtocart.png"
CommandName="addtocart" />
Th image of add to cart is not coming.On running the application and looking to property of image it shows the url of page as
http://localhost:3811/Sections/flat-panel-displays-222
Instead of image url where it is stored i.e. http://localhost:3811/images/addtocart.png
|
|
|
|
|
Hi All,
I've got text going into a DB which may contain links, or naked URL's.
I do cleanup on the way in to avoid XSS attacks, but on the way out, I want any URL's to display as links.
So, I've got a couple possibilities. If the link is already within an anchor tag, then I want it to display properly as a link.
If the link is a plain URL within the text, I need to add an anchor tag.
I'm currently using:
Regex.Replace(dr.Item(1), "(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])", Function(match As Match) String.Format("<a href=""{0}"">{0}</a>", match.ToString()), RegexOptions.IgnoreCase)
This will add an anchor tag surrounding a naked URL, but what I need is for it not to act on a URL that is already within an anchor tags.
Help please?
|
|
|
|
|
Save yourself the trouble and clean the anchor tags from the string prior to saving to the database. As a rule of thumb you should never store formatted items in the database, let the formatting happen at the presentation layer. That way when the business rules change, or the data needs to be used in different context, it's easier to adapt.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Ok, I've narrowed down the question.
I have a Regex that matches a naked URL ( http://www.whatever.com/whatever.... )
What I need to know is what to add to the beginning and end of that Regex so that it does not match if there is a double quote right before or after the URL.
It's the "NOT QUOTES" thing that I'm not getting.
|
|
|
|
|
hi friends,
Can you give me a reference how to validate email address with asp.net? I want to check
that email address exists or not.Some one suggested to use windows dos command nslookup to find email server, but if I use a shared hosting that might not be a good idea.
So can you guys give me an idea or reference how to make things work??
Thanks
|
|
|
|
|
There is no way to validate an actual email. You can validate its format using a Regex and you can validate the email server, but there is no way to actually know an email address exists, is valid, and can receive your message.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
hello friends
my asp application facilitates downloading files from one server to many clients computers. but when i tested download speed from a client computer, i realized that it is too slow. But when i use "remote desktop" (i mean connecting to server via remote desktop) downloading is becoming so fast. I am using this code:
FileInfo fi = new FileInfo(FileURL);
HttpContext.Current.Response.ContentType = "application/vnd.xls";
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename =" + fi.Name);
HttpContext.Current.Response.TransmitFile(FileURL);
HttpContext.Current.Response.End();
So i want to ask that what kind of a connection does remote desktop use. And how can i make my downloads faster. thank you
|
|
|
|
|
You mean, the download speed of your server was fast (you logged in with remote desktop and downloaded a file to your server), while the download of a client (file from your server) was slow?
The reason for that could be a upstream/downstream speed difference of the internet connection of your server.
While the first szenario is a downstream szenario, the latter one is upstream (from the server point of view).
In general, you have to differ between upstream/downstream speed and client/server connection speed. Your clients
will usually have a slower internet connection.
|
|
|
|
|
Where do you store the file when you use remote desktop? If it's in your normal documents or downloads directory, that file never leaves your server, because these directories are also on the server computer. Nothing travels over the wire.
Apart from that, remote desktop uses this internally: http://msdn.microsoft.com/en-us/library/aa383546(v=VS.85).aspx[^]
Citrix uses something similar, but the interface is a bit more complicated (and you need to get a developer license to get at it).
|
|
|
|
|
I am using a radGrid which automatically sorts the bound columns; however, the griv also contains textbox columns which get out of sync once the bound columns are sorted. Can anyone help me with this? code below:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.WebControls;
using System.Collections;
using System.Data;
public partial class _Default : System.Web.UI.Page
{
protected RadGrid grid;
protected static ArrayList list = new ArrayList();
override protected void OnInit(EventArgs e)
{
DefineGridStructure();
base.OnInit(e);
}
private void DefineGridStructure()
{
this.grid = new RadGrid();
this.grid.AutoGenerateColumns = false;
this.grid.NeedDataSource += new GridNeedDataSourceEventHandler(OnNeedDataSource);
// this.grid.Page = this;
this.grid.AllowPaging = true;
this.grid.AllowSorting = true;
this.grid.PageSize = 4;
this.grid.Width = 650;
//other columns definitions ----------------------------
string templateColumnName = "TextBox Column 1";
GridTemplateColumn templateColumn = new GridTemplateColumn();
templateColumn.ItemTemplate = new MyTemplate(templateColumnName);
templateColumn.HeaderText = templateColumnName;
templateColumn.HeaderStyle.Width = 300;
string templateColumnName3 = "TextBox Column 2";
GridTemplateColumn templateColumn3 = new GridTemplateColumn();
templateColumn3.ItemTemplate = new MyTemplate3(templateColumnName3);
templateColumn3.HeaderText = templateColumnName3;
templateColumn3.HeaderStyle.Width = 300;
GridBoundColumn boundColumn1 = new GridBoundColumn();
boundColumn1.DataField = "B";
boundColumn1.UniqueName = "ConactName2";
boundColumn1.HeaderText = "Bound Column";
boundColumn1.HeaderStyle.Width = 300;
string templateColumnName2 = "Dropdown List Column";
GridTemplateColumn templateColumn2 = new GridTemplateColumn();
templateColumn2.ItemTemplate = new MyTemplate2(templateColumnName2);
templateColumn2.HeaderText = templateColumnName2;
templateColumn2.HeaderStyle.Width = 300;
this.grid.MasterTableView.Columns.Add(templateColumn);
this.grid.MasterTableView.Columns.Add(templateColumn2);
this.grid.MasterTableView.Columns.Add(boundColumn1);
this.grid.MasterTableView.Columns.Add(templateColumn3);
grid.AllowPaging = true;
grid.PageSize = 5;
grid.ClientSettings.Scrolling.AllowScroll = true;
grid.ClientSettings.Scrolling.ScrollHeight = 230;
grid.ClientSettings.Scrolling.ScrollWidth = 1200;
this.PlaceHolder1.Controls.Add(grid);
}
protected void grid_NeedDataSource(object source, Telerik.WebControls.GridNeedDataSourceEventArgs e)
{
this.grid.DataSource = list;
}
protected void Page_Load(object sender, EventArgs e)
{
ArrayList alist = new ArrayList();
list = new ArrayList();
alist.Add("1");
alist.Add("2");
list.Add( new TestListItem( "ItemA 0", "ItemB a", "ItemC a", alist ));
list.Add( new TestListItem( "ItemA 1", "ItemB b", "ItemC b", alist ));
list.Add( new TestListItem( "ItemA 2", "ItemB c", "ItemC c", alist ));
list.Add( new TestListItem( "ItemA 3", "ItemB d", "ItemC d", alist ));
list.Add( new TestListItem( "ItemA 4", "ItemB e", "ItemC e", alist ));
list.Add( new TestListItem( "ItemA 5", "ItemB f", "ItemC f", alist ));
}
private class MyTemplate : ITemplate
{
protected TextBox textBox1;
static int i;
private string colname;
public MyTemplate(string cName)
{
colname = cName;
}
public void InstantiateIn(System.Web.UI.Control container)
{
textBox1 = new TextBox();
textBox1.ID = "templateColumnTextBox";
textBox1.DataBinding += new EventHandler (this.BindTextBox1);
container.Controls.Add(textBox1);
}
void BindTextBox1(object sender, EventArgs e)
{
if (i >= list.Count)
i = 0;
if ( i < list.Count)
{
((TextBox)sender).Text = ((TestListItem)list[i]).A;
i++;
}
}
}
private class MyTemplate2 : ITemplate
{
protected DropDownList ddlValue;
private string colname;
public MyTemplate2(string cName)
{
colname = cName;
}
public void InstantiateIn(System.Web.UI.Control container)
{
ddlValue = new DropDownList();
ddlValue.ID = "templateColumnDropDownList";
ddlValue.CssClass = "DropDownList";
ddlValue.DataBinding += new EventHandler (this.BindDropDownList);
container.Controls.Add(ddlValue);
}
void BindDropDownList(object sender, EventArgs e)
{
((DropDownList)sender).DataSource = ((TestListItem)list[0]).AList;
}
}
private class MyTemplate3 : ITemplate
{
protected TextBox textBox3;
static int i;
private string colname;
public MyTemplate3(string cName)
{
colname = cName;
}
public void InstantiateIn(System.Web.UI.Control container)
{
textBox3 = new TextBox();
textBox3.ID = "templateColumnTextBox3";
textBox3.DataBinding += new EventHandler (this.BindTextBox3);
container.Controls.Add(textBox3);
}
void BindTextBox3(object sender, EventArgs e)
{
if (i >= list.Count)
i = 0;
if ( i < list.Count)
{
((TextBox)sender).Text = ((TestListItem)list[i]).C;
i++;
}
}
}
void OnNeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
grid.DataSource = list;
}
public class TestListItem
{
private string _a;
private string _b;
private string _c;
ArrayList _aList;
public TestListItem( string a, string b, string c, ArrayList aList )
{
this._a = a;
this._b = b;
this._c = c;
this._aList = aList;
}
public string A
{
get
{
return this._a;
}
set
{
this._a = value;
}
}
public string B
{
get
{
return this._b;
}
set
{
this._b = value;
}
}
public string C
{
get
{
return this._c;
}
set
{
this._c = value;
}
}
public ArrayList AList
{
get
{
return this._aList;
}
set
{
this._aList = value;
}
}
}
}
|
|
|
|
|
The last post I made like this one got
voted down but I'm doing it again anyways ....
http://www.telerik.com/support.aspx[^]
Part of the HIGH cost of these controls
is the very excellent support provided.
|
|
|
|
|
When I go to their support site I am unable to access my post. If possible could someone look at the code, it is very simple, and see if they have any ideas? If this is not a proper post for this site please let me know and i will not post anything else about this issue.
Thanks,
Steve Holdorf
|
|
|
|
|
Don't take it personal, personally I can't afford
radControls but from your post I can see their
value.
Your posts here are not only welcomed but encouraged.
|
|
|
|
|
A lot of hard work but I got it. Thanks anyway.
Thanks,
Steve Holdorf
|
|
|
|
|
Hi,
i have an object with a method which returns a string
public class Object
{
public Object(){}
public string methodName()
{
string result = ...some calculations...
return result;
}
}
im using this object as datasource for GridView1
GridView1.DataSource=Object1;
now i want to bind this method to GridView1 column
<%# Bind("methodName()")%>
but it fails..
when i bind a property its works ok, but i need bind a result returd from method.
Is is possible or there is any work around?
thanks
|
|
|
|
|
I haven't tried this, but as you said property is working fine, then have a property like this
public string GetValue
{
get
{
return methodName();
}
}
And use this property.
|
|
|
|
|
yes, but its gonna run this method every time i create an object.
i want only run this method when i need..
i gonna read your article,
thanks for answer
|
|
|
|
|
marijus5 wrote: but its gonna run this method every time i create an object.
Have some logic when you wanna create it else you can also store it somewhere say viewstate etc...
marijus5 wrote: i gonna read your article
Pls share your feedback
|
|
|
|
|
hi guys im actually working on C# web application on VS2003(Version 1.1) in my web page i have a date picker now the date gets stored in a string this way:
string FrmDt=DtP_frm.Text.Replace("/","");
so the string stored here is in format like this --> 12042010, with this string i retrieve my records from database with search query. but in the database i have to pass this string as --> 20100412 which is yyyymmdd format... How do i achieve this...
Any advise is appreciated...
Thanx in advance,
Tash
|
|
|
|
|
<<tash18>> wrote: string FrmDt=DtP_frm.Text.Replace("/","");
In here, before replacing the '/', convert into the yyyymmdd format that you need and then replace the '/', pass on as search parameter to Database.
Like:
String tempDate = Convert.ToDateTime(DtP_frm.Text).ToString("yyyy/MM/dd");
Now use this tempDate for your manipulation of removing the '/' and passing to DB.
|
|
|
|
|
Hi,
I have basically the following structure set up :
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" DataSourceID="ObjectDataSource1" ... >
:
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" ... >
</asp:ObjectDataSource>
<asp:ImageButton ID="NewInsertButton" runat="server" OnClick="NewInsertButton_Click" />
<asp:FormView ID="FormView1" runat="server" DataSourceID="ObjectDataSource2" ... >
<InsertItemTemplate>
:
<asp:FileUpload ID="FileUpload1" runat="server" />
:
<asp:ImageButton ID="ImageButton1" runat="server" CommandName="Insert" />
</InsertItemTemplate>
:
</asp:FormView>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" ... >
</asp:ObjectDataSource>
</ContentTemplate>
</asp:UpdatePanel>
I am aware that a FileUpload requires a full page postback. I read the article
http://www.4guysfromrolla.com/articles/090209-1.aspx[^]
I tried to install a PostBackTrigger programmatically to get a full postback only on the ImageButton1 control. All other postbacks must be partial. (GridView sorting, paging, ...)
In code behind I do :
protected void NewInsertButton_Click(object sender, ImageClickEventArgs e)
{
FormView1.ChangeMode(FormViewMode.Insert);
FormView1.DataBind();
ImageButton InsertButton = FormView1.FindControl("ImageButton1") as ImageButton;
if (InsertButton == null)
throw new NullReferenceException("ImageButton1");
ScriptManager Manager = ScriptManager.GetCurrent(Page);
if (Manager == null)
throw new NullReferenceException("ScriptManager");
Manager.RegisterPostBackControl(InsertButton);
:
}
The above code does not seem to install a full postback only for the ImageButton1, so the file upload fails. How can I make this work ?
|
|
|
|
|
![Go to Parent](https://www.codeproject.com/App_Themes/CodeProject/Img/arrow-up24.png) Because I can't work with your code as prsented
I will give this very simple example of an udatepanel
containing a button for update and another button for
postback ...
Hope it helps .
<%@ Page Language="C#" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e){
if (Page.IsPostBack) { myLabel.Text = "posted back"; }
ScriptManager current = ScriptManager.GetCurrent(Page);
if (current != null)
{ current.RegisterPostBackControl(Button2); }
}
protected void Button1_Click(object sender, EventArgs e)
{
DropDownList1.Items.Clear();
String[] ds = {"hi RED","sup RED"};
String[] ds1 = { "hi BLUE", "sup BLUE" };
if (DropDownList2.SelectedValue == "RED")
{ DropDownList1.DataSource = ds;
DropDownList1.DataBind(); }
if (DropDownList2.SelectedValue == "BLUE")
{ DropDownList1.DataSource = ds1;
DropDownList1.DataBind();
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
<style type="text/css">
#UpdatePanel1 { width:300px; height:100px; } </style>
</head>
<body>
<form id="form1" runat="server">
<div style="padding-top: 10px">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<fieldset>
<legend>UpdatePanel</legend>
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
<asp:DropDownList ID="DropDownList2" runat="server">
<asp:ListItem>RED</asp:ListItem>
<asp:ListItem>BLUE</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="UpDate" />
<asp:Button ID="Button2" runat="server" Text="PostBack" />
</fieldset>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<asp:Label runat="server" ID="myLabel"></asp:Label>
</div>
</form>
</body>
</html>
modified on Sunday, April 18, 2010 10:49 AM
|
|
|
|
|
Thx for the reply. I appreciate your effort. I tested your code, and yes it works,
but in my case I use form views which creates their embedded controls dynamically.
I found numerous examples on the net, demonstrating how it has to be done, but I found
none which resembles my senario.
For one reason or another my code does not function, and I would like to know why.
|
|
|
|
|
If you could present some very brief but complete
code that illistates your problem I could easily
correct it, but it must be brief and complete.
|
|
|
|