|
You should load all images firstly. then, you can use the Javascript to change the image on the fly..
|
|
|
|
|
Hi Friends,
i having two html radio buttons,one dropdownlist control and textbox control when i select first radio button it should display the empty textbox and dropdownlist control should be hide and datagrid also should hide,when i m clicking second radio button the textbox should be hide and dropdownlist control should appear.when i m selecting dropdownlist values the result should come in datagrid,up till this working when i m clicking edit,save,cancel or delete button in datagrid the selected radio button getting unchecked.Kindly tell me how to check the radio button.Please help me....
Thanks & Regards
Senthil Kumar
|
|
|
|
|
Which radiobutton are you using? I mean, server controls or just HTML control? I think if you are using the server control, you should not have that problem.. However, in order to solve this, I suggest you to store the radiobutton value in cache or session and set it back in pageload...
|
|
|
|
|
|
then, I suggest you to store the radiobutton value in cache or session and set it back in pageload...
|
|
|
|
|
Hi all,
i am setting the selected value of a calander like this...
calendarDateOfBirth.SelectedDate = Convert.ToDateTime(_member.DateOfBirth)
how do you make the calander display this selected date now??? i know the date is correct but i dont know how to display it on the calander?
I can write the value to the database and it works fine with the correct value i just dont know how to display it... please help
Thank you in advance.
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
How do you want to display it ? What calendar control are you using ? Why doesn't the SelectedDate property solve your problem ? Is Convert.ToDateTime working ?
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 )
|
|
|
|
|
i think the convert is working...
the thing is... calDateOfBirth.SelectedDate = Convert.ToDateTime(_member.DateOfBirth.ToString());
the date is set correctly on the calender... i can click on the previouse month arrow up to the correct month and see the selected date (as the correct date). When the page is loaded it is displaying the today date not the selected date? how do you specify to show the selected date on the calender itself like it is showing the current date???
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
ha ha, never mind... i figured it out...
right after this section of code:
calDateOfBirth.SelectedDate = Convert.ToDateTime(_member.DateOfBirth.ToString());code> i have added this:<br />
<br />
<code>calDateOfBirth.VisibleDate = calDateOfBirth.SelectedDate;
it is working fine now Thank you for your time any way.
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
try setting VisibleDate as well asa SelectedDate (you would assume that VisibleDate is set to SelectedDate but it isnt by default!)
|
|
|
|
|
Hi Before creating my own CSS sheet i created some forms for my project...,
In that i given some controls my own style...,
Now i like to show all my forms on same styles...,
So i created one proper CSS...,
now i like to implement that one for my forms...,
I dont like to go each forms and change what i have given previous those designs...,
How to remove those designs and how to implement newly created CSS?,
Its any other way is there?,
Thanks & Regards,
Mageshh,
please don't forget to vote on the post
|
|
|
|
|
You include the css in your form, and if you used named classes, you set the class names of the controls.
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 )
|
|
|
|
|
Hai,
Can anybody give me the code snippet for the tree view to be get populated with xml nodes.
Eg. Say i am having an xml file that contains information about one book. And i want to add the chapter's headings and the sections headings in the tree view .
VanithaVasu
|
|
|
|
|
|
This is the error while i tried to bind the xml file with treeview
HierarchicalDataBoundControl only accepts data sources that implement IHierarchicalDataSource or IHierarchicalEnumerable.
My code is
DataSet ds = new DataSet();<br />
ds.ReadXml(Server.MapPath("xmlfile.xml"));<br />
<br />
TreeView1.DataSource = ds;<br />
TreeView1.DataBind();
My xml file contents are
<?xmlversion = "1.0" encoding="utf-8" ?>
<countries>
<country>
<text>Norway</text>
<value>N</value>
</country>
</countries>
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
modified on Thursday, January 03, 2008 4:15:38 AM
|
|
|
|
|
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("."))
|
|
|
|
|