|
Sonia Gupta wrote: HierarchicalDataBoundControl only accepts data sources that implement IHierarchicalDataSource or IHierarchicalEnumerable.
Error message explains itself the problem. Check this[^] for more information. Or you can use XMLDataSource too.
|
|
|
|
|
DataSet aDataSet = new DataSet();
aDataSet.ReadXml(new StringReader(aXmlDoc.OuterXml));
the refered[^] article contains the above code.
i am unable to understand , how can i invoke the OuterXml ,
it is not appearing in the control properties(xml data source)
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
|
u have any link that delete,edit , update , insert the data using xml data source ?
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
I have never used this one. So I don't have any good links. Isn't that MSDN example works ?
|
|
|
|
|
No ,Actually i was trying to insert delete the recors dynamically.
do u have one such link?
and one ore thing ,
i have a Command Field control , on clickig the update button , i have to validate the textbox , having the date information, Initially i used the regular expression , but the moment i wrote 30/2/2000 (dd/mm/yyyy), it did not validate , that's y i prefered to use the java script,
how should i find out programically the update button of command field , in order to validate the date .
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
Sonia Gupta wrote: TreeView1
I know I've told you this at least 15 times, but why wouldn't you use sensible variable names ?
I've never used a TreeView control in ASP.NET, but your error message gave me an interface name, and by typing it in to google, I discovered that you need to set up an XmlDataSource in order to use XML to bind to a tree view.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: I know I've told you this at least 15 times,
haha. maybe.. he wants to hear more and more..
|
|
|
|
|
Hi friends.
I have coded to create text image using handler.But i can not get clarity of the image.
please visit these links.
BuildAsign[^] and Mysite[^]
My handler code here
public class getImage : IHttpHandler
{
MemoryStream PlotText(string text)
{
try
{
string fontFamily = GetArg("family", "Verdana");
float fontSize = float.Parse(GetArg("size", "12")); // assumed to be pixels
bool fontBold = bool.Parse(GetArg("bold", "false"));
bool fontItalic = bool.Parse(GetArg("italic", "false"));
bool fontUnderline = bool.Parse(GetArg("underline", "false"));
int iWidth = int.Parse(GetArg("width", "100"));
int iHeight = int.Parse(GetArg("height", "100"));
//int action = int.Parse(GetArg("action", "0"));
iHeight = int.Parse(fontSize.ToString()) + 10;
string isImage = GetArg("isImage", "true");
Color fontColor = GetColor(GetArg("color", "Black"));
//this is namespace for true virtual catch
if (text.Length > 100)
text = text.Substring(0, 100);
if (fontSize > 400)
fontSize = 400;
iWidth = text.Length * int.Parse(fontSize.ToString());
SizeF size = new SizeF(1, 1);
Font font = null;
try
{
Bitmap bitmap = new Bitmap(1, 1);
Graphics g = Graphics.FromImage(bitmap);
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.TextRenderingHint =TextRenderingHint.AntiAlias;
g.SmoothingMode = SmoothingMode.HighQuality;
FontStyle fontStyle = FontStyle.Regular;
if (fontBold) fontStyle |= FontStyle.Bold;
if (fontItalic) fontStyle |= FontStyle.Italic;
if (fontUnderline) fontStyle |= FontStyle.Underline;
//fontSize = ((float)(iWidth / iHeight)) + iWidth;
font = new Font(fontFamily, fontSize, fontStyle, GraphicsUnit.World);
// could get fancy here with StringFormat options
size = g.MeasureString(text, font);
int mW = int.Parse(fontSize.ToString()) / 2;
int w = mW / 2;
//if (isImage == "true")
// bitmap = new Bitmap((int)size.Width+w - mW, (int)size.Height - mW, PixelFormat.Format64bppPArgb);
//else
bitmap = new Bitmap((int)size.Width, (int)size.Height, PixelFormat.Format64bppPArgb);
g = Graphics.FromImage(bitmap);
SolidBrush br = new SolidBrush(Color.White);
g.FillRectangle(br, 0, 0, bitmap.Width, bitmap.Height);
br = new SolidBrush(fontColor);
//StringFormat sf = new StringFormat();
//sf.Alignment = StringAlignment.Center;
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
//g.TextRenderingHint = TextRenderingHint.AntiAlias;
//if (isImage == "true")
// g.DrawString(text, font, br, new PointF(-w + 5, -w + 2));
//else
g.DrawString(text, font, br, new PointF(0,0));
MemoryStream m = new MemoryStream();
bitmap.Save(m, ImageFormat.Gif);
return MakeTransparent(m);
}
finally
{
if (font != null) font.Dispose();
}
}
catch
{
return PlotError();
}
}
MemoryStream PlotError()
{
MemoryStream m = new MemoryStream();
using (Bitmap bitmap = new Bitmap(40, 15, PixelFormat.Format32bppArgb))
{
using (Graphics g = Graphics.FromImage(bitmap))
{
using (SolidBrush br = new SolidBrush(Color.White))
{
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
g.FillRectangle(br, 0, 0, bitmap.Width, bitmap.Height);
}
using (Pen p = new Pen(Color.Red))
{
g.DrawLine(p, 0, 0, bitmap.Width, bitmap.Height);
g.DrawLine(p, 0, bitmap.Height, bitmap.Width, 0);
}
bitmap.Save(m, ImageFormat.Gif);
}
}
return MakeTransparent(m);
}
void ok()
{
SetResponse(HttpStatusCode.OK, "Ok");
}
void error()
{
error(HttpStatusCode.BadRequest, "Bad Request");
}
void error(HttpStatusCode statusCode, string statusDescription)
{
SetResponse(statusCode, statusDescription);
_response.BinaryWrite(PlotError().ToArray());
_response.End();
}
#region ---- Process Request -----
HttpRequest _request;
HttpResponse _response;
public void ProcessRequest(HttpContext context)
{
_request = context.Request;
_response = context.Response;
if (!(("GET" == _request.RequestType) || ("HEAD" == _request.RequestType)))
error(HttpStatusCode.MethodNotAllowed, "Method Not Allowed");
string text = GetArg("text", "");
if (text.Length == 0)
error();
ok();
_response.BinaryWrite(PlotText(text).ToArray());
}
#endregion
public bool IsReusable
{
get { return false; }
}
// --------------------------------------------------------------------
string GetArg(string argName, string argDefault)
{
string arg = _request.QueryString[argName];
if ((null == arg) || (arg.Length == 0)) return argDefault;
return arg;
}
void SetResponse(HttpStatusCode statusCode, string statusDescription)
{
_response.ContentType = "image/gif";
_response.StatusCode = (int)statusCode;
_response.StatusDescription = statusDescription;
_response.Flush();
}
Array Redim(Array origArray, int newSize)
{
Type t = origArray.GetType().GetElementType();
Array newArray = Array.CreateInstance(t, newSize);
Array.Copy(origArray, 0, newArray, 0, Math.Min(origArray.Length, newSize));
return newArray;
}
Color GetColor(string color)
{
if (color.StartsWith("#"))
{
return Color.FromArgb(IntFromHexRgbPart(color, RgbPart.RgbPartRed),
IntFromHexRgbPart(color, RgbPart.RgbPathGreen),
IntFromHexRgbPart(color, RgbPart.RgbPartBlue)
);
}
return Color.FromName(color);
}
enum RgbPart { RgbPartRed, RgbPathGreen, RgbPartBlue };
int IntFromHexRgbPart(string hexRgb, RgbPart part)
{
if ((null == hexRgb) || (hexRgb.Length == 0) || (!(hexRgb.StartsWith("#"))))
return 0;
try
{
switch (part)
{
case RgbPart.RgbPartRed:
if (hexRgb.Length < 3) return 0;
return IntFromHex(hexRgb.Substring(1, 2));
case RgbPart.RgbPathGreen:
if (hexRgb.Length < 5) return 0;
return IntFromHex(hexRgb.Substring(3, 2));
case RgbPart.RgbPartBlue:
if (hexRgb.Length < 7) return 0;
return IntFromHex(hexRgb.Substring(5, 2));
default:
return 0;
}
}
catch { return 0; }
}
int IntFromHex(string hex)
{
return (int)byte.Parse(hex, System.Globalization.NumberStyles.HexNumber);
}
MemoryStream MakeTransparent(MemoryStream origBitmapMemoryStream)
{
Color transparentColor = GetColor("White");
int transparentArgb = transparentColor.ToArgb();
using (Bitmap origBitmap = new Bitmap(origBitmapMemoryStream))
{
using (Bitmap newBitmap = new Bitmap(origBitmap.Width, origBitmap.Height, origBitmap.PixelFormat))
{
ColorPalette origPalette = origBitmap.Palette;
ColorPalette newPalette = newBitmap.Palette;
int index = 0;
int transparentIndex = -1;
foreach (Color origColor in origPalette.Entries)
{
newPalette.Entries[index] = Color.FromArgb(255, origColor);
if (origColor.ToArgb() == transparentArgb) transparentIndex = index;
index += 1;
}
if (-1 == transparentIndex)
{
return origBitmapMemoryStream;
}
newPalette.Entries[transparentIndex] = Color.FromArgb(0, transparentColor);
newBitmap.Palette = newPalette;
Rectangle rect = new Rectangle(0, 0, origBitmap.Width, origBitmap.Height);
BitmapData origBitmapData = origBitmap.LockBits(rect, ImageLockMode.ReadOnly, origBitmap.PixelFormat);
BitmapData newBitmapData = newBitmap.LockBits(rect, ImageLockMode.WriteOnly, newBitmap.PixelFormat);
for (int y = 0; y < origBitmap.Height; y++)
{
for (int x = 0; x < origBitmap.Width; x++)
{
byte origBitmapByte = Marshal.ReadByte(origBitmapData.Scan0, origBitmapData.Stride * y + x);
Marshal.WriteByte(newBitmapData.Scan0, newBitmapData.Stride * y + x, origBitmapByte);
}
}
newBitmap.UnlockBits(newBitmapData);
origBitmap.UnlockBits(origBitmapData);
MemoryStream m = new MemoryStream();
newBitmap.Save(m, ImageFormat.Gif);
return m;
}
}
}
}
please don't forget to vote on the post that helped you.
|
|
|
|
|
Hi I am trying use OWC chart component to draw a comparative graph that will show
list of years and sales actual and sales budgeted. so i have three columsn
year actual budgeted
2004 20 30
2005 21 32
now i am trying to show year in x axis and have seperate graphs for 20 and 30 in year 2004 and 2005. I am not getting able to show both i can only show one can any please help me with it i have attached the code for easy understanding
------
Dim dsPropertyCapex As DataSet = myDAL.getBudgetVsActual(domainid, locationid, buildingcomponentid, PortfolioId, userId)
If Not dsPropertyCapex Is Nothing Then
gvPropertyHisex.DataSource = dsPropertyCapex
gvPropertyHisex.DataBind()
'Now Build a graph from the dataset
Dim oChartSpace As New Owc11.ChartSpaceClass()
Dim objChart As Owc11.ChChart = oChartSpace.Charts.Add(0)
objChart.HasTitle = True
objChart.Title.Caption = "Capital Expenditure Graph"
objChart.HasLegend = True
objChart.Legend.Border.DashStyle = Owc11.ChartLineDashStyleEnum.chLineDash
objChart.Legend.Position = Owc11.ChartLegendPositionEnum.chLegendPositionRight
Dim sw As New System.IO.StringWriter()
Dim xDoc As New XmlDocument()
dsPropertyCapex.WriteXml(sw)
' clean up
xDoc.LoadXml(sw.ToString())
sw.Close()
Dim nodes As System.Xml.XmlNodeList
nodes = xDoc.ChildNodes.Item(0).ChildNodes
Dim nCount As Integer = nodes.Count
Dim aActual As String() = New String(nCount - 1) {}
Dim aBudgeted As String() = New String(nCount - 1) {}
Dim aEOY As String() = New String(nCount - 1) {}
Dim Actual As String = [String].Empty
Dim Budgeted As String = [String].Empty
Dim EOY As String = [String].Empty
Dim i As Integer = 0
For i = 1 To nCount
aActual(i - 1) = nodes.Item(i - 1).ChildNodes.Item(0).InnerText
aBudgeted(i - 1) = nodes.Item(i - 1).ChildNodes.Item(1).InnerText
aEOY(i - 1) = nodes.Item(i - 1).ChildNodes.Item(2).InnerText
Next
Actual = [String].Join("" & Chr(9) & "", aActual)
Budgeted = [String].Join("" & Chr(9) & "", aBudgeted)
'Chart control accepts tab-delimited string of values
EOY = [String].Join("" & Chr(9) & "", aEOY)
'oChartSpace.Charts.Add(0)
objChart.SeriesCollection.Add(0)
objChart.SeriesCollection(0).SetData(Owc11.ChartDimensionsEnum.chDimValues, Convert.ToInt32(Owc11.ChartSpecialDataSourcesEnum.chDataLiteral), Actual)
objChart.SeriesCollection(0).SetData(Owc11.ChartDimensionsEnum.chDimCategories, Convert.ToInt32(Owc11.ChartSpecialDataSourcesEnum.chDataLiteral), EOY)
'objChart.SeriesCollection(0).SetData(Owc11.ChartDimensionsEnum.chDimCategories, Convert.ToInt32(Owc11.ChartSpecialDataSourcesEnum.chDataLiteral), Actual)
'objChart.SeriesCollection(0).SetData(Owc11.ChartDimensionsEnum.chDimCategories, Convert.ToInt32(Owc11.ChartSpecialDataSourcesEnum.chDataLiteral), Budgeted)
objChart.SeriesCollection.Add(1)
objChart.SeriesCollection(1).SetData(Owc11.ChartDimensionsEnum.chDimValues, Convert.ToInt32(Owc11.ChartSpecialDataSourcesEnum.chDataLiteral), Budgeted)
Dim strFullPathAndName As String = Server.MapPath(System.DateTime.Now.Ticks.ToString() + ".gif")
oChartSpace.ExportPicture(strFullPathAndName, "gif", 600, 400)
imgCapexGraph.ImageUrl = Server.UrlEncode(Path.GetFileName(strFullPathAndName))
imgCapexGraph.Visible = True
RemoveFiles(Server.MapPath("."))
|
|
|
|
|
in the code project , the moment I click the thread to view the question , it instantly gets appeared (i have selected the normal option in the page (code project site)) . When i select the no java script , it takes time .In both the case , the request definitely goes to the server
Now my question is
1. what should I do In order to perform the same task?
What I thought so far is the jaa script, and java script database connectivity
2.Is this the right way to perform the task?
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
Sonia Gupta wrote: In both the case , the request definitely goes to the server
No in the normal case, all answers will be pre-loaded and request won't go to the server.
Sonia Gupta wrote: what should I do In order to perform the same task?
It's just javascript and styles. You can find it looking into this page source.
|
|
|
|
|
ok Navaneeth , i am trying.
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
Sonia Gupta wrote: In both the case , the request definitely goes to the server
What on earth made you thin that ? Turn on javascrpt. Browse to the lounge. Disconnect from the web and click on a post. You will find you can see it. There is no request to the server.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello Everyone,
I'm creating directory in my project....but it's throwing an error
"Access to the path "c:\inetpub\wwwroot\KiritBhai\Gallery\Manoj" is denied"
My code is here as given below......
string add=Server.MapPath("../Gallery/")+"Manoj";
DirectoryInfo dir=new DirectoryInfo(add);
dir.Create();
but whenever i'm creating this folder in a drive like c,d and etc.
Then it's rocking..............
|
|
|
|
|
The Knowledge wrote: I'm creating directory in my project....but it's throwing an error
"Access to the path "c:\inetpub\wwwroot\KiritBhai\Gallery\Manoj" is denied"
Give write permission to your ASP.NET account. Or use impersonation.
|
|
|
|
|
where to put the mpersonation in my code plz explain
|
|
|
|
|
The Knowledge wrote: where to put the mpersonation in my code
You will get many results from google[^]. You should impersonate user before creating directory and remove impersonation after it's done.
|
|
|
|
|
Hi,
i want to Filter Items in a dropdown box when i type data in textbox.ie,if i will type A i want to display items from database based on A and when i press enter from the box i want to display that specified name in Textbox.based on that name i want to display value also.i want to scroll the items in that box also.if any one knows about this please let me know at the earliest
with regards,
Anu
|
|
|
|
|
I think AJAX toolkit has such a control. Have you checked ?
|
|
|
|
|
|
|
|
Hi
If u want to do it asynchronously then u can use AJAX and if u dont
mine if page get post back then on textchanged event use ilke query
and retrieve data from database using text in text box.
Regards.
Rahul.
People Laugh on me Because i am Different but i Laugh on them Because they all are same.
|
|
|
|
|
Hi all,
I am new in Asp.Net.I want to use Servlets, Applets, Xml, XHTML and JavaScript in my website.
But I am not sure about Applets and Servlets, Whether these can be used in asp.Net or not.Urgent Response will be appritiated.
Regrds,
chanzeb chaudhary.
|
|
|
|
|