|
Hi ,
Is there any free chat tools like we see in Gmail ?Is there any way to implement chat like what we see in gmail ?.Please help me.
With Regards .
|
|
|
|
|
|
I am working with a website where I present a question in a panel and then I submit three alternatives as answers in a checkbox or a radiobuttonlist. I get the information from a database, create webcontrols and then insert them into the panel. Some questions need to randomize the order of the answer alteratives, and that happens when the webcontrol is created. Every time the page is reloaded, the information gets read from the database, the webcontrol is created and put into the panel. This means that i I have like "What is the capital of Sweden?" 1. Stockholm, 2. Oslo, 3. Copenhagen. I have the radiobtn as autopostback, and when I click 1. Stockholm the page reloads, and the next time the alternatives is for example 1. Oslo 2. Copenhagen 3. Stockholm, but Stockholm is still checked and that is good. Thats the way I want it.
Now my problem:
When I do the exact same thing with checkboxlist (I put listItems in the list) the selection in the checkbox doesn't follow the alternative. So if I have 1. Stockholm, 2. Oslo, 3. Copenhagen I click 1. Stockholm, the page reloads, the names order are randomized, but the selection remains. The result could be 1. Oslo, 2. Copenhagen, 3. Stockholm but now Oslo has been selected since the selection doesn't connect to the alternative.
The code for creating the RadioButtonList is exactly the same as the one for CheckBoxList. It works with the radiobuttons, but not with the chekboxes. Why??
|
|
|
|
|
Besa72 wrote:
Stockholm the page reloads, and the next time the alternatives is for example 1. Oslo 2. Copenhagen 3. Stockholm, but Stockholm is still checked and that is good.
just a note, don't you think it would be confusing to the user, that the answer choices change on each post back?
Anyways if u want it like that, it is sure for a reason.
Regarding ur problem, can u show us some code?
|
|
|
|
|
The reason the control postsbacks is just by developing reasons. When it is done it will not work like that. But the finished page will work like that anyway although you wont see it. I will try to explain:
1. When I click the "next question" button the page_load runs again.
2. In the page_load the querysting checks the number of the question
3. the question is loaded from the databse
4. In the database there is a field for random on/off.
5. The checkedlistbox webcontrol object is created.
6. If random - random values are created and put into a list (in this case the list could look liek this: 2, 0, 1)
7. The name of the towns are added into the checkedlistbox as listitems, the order of the listitems is added like this:
for (int i = 0; i < this.LstChkBoxes.Count; i++)
{
myCheckBoxList.Items.Add(new ListItem(this.LstChkBoxes[lstRandom[i]].sText, this.LstChkBoxes[lstRandom[i]].nAlternatives.ToString()));
}
8. The webcontrol is then added into the panel on the webpage, but in a different order than before. In the radiobutton-case the selection is attached to the choice on the second rendering of the page, but not in the checkboxcase.
This is the code that creates the webcontrol CheckBoxList
public override WebControl ToWebControl()
{
myCheckBoxList = new CheckBoxList();
myCheckBoxList.BackColor = ColorTranslator.FromWin32((int)CrBkColor);
myCheckBoxList.Style.Add("Position", "Absolute");
myCheckBoxList.Style["Top"] = ITop.ToString() + "px";
myCheckBoxList.Style["Left"] = ILeft.ToString() + "px";
myCheckBoxList.Style.Add("z-index", this.Order.ToString());
myCheckBoxList.ID = this.checkboxId.ToString();
myCheckBoxList.AutoPostBack = true;
if (this.BRandomShow)
{
Random rand = new Random();
List<int> lstRandom = new List<int>();
while (nmbrsAdded == false)
{
int rnd1 = rand.Next(0, this.LstChkBoxes.Count);
if (!lstRandom.Contains(rnd1))
{
lstRandom.Add(rnd1);
if (lstRandom.Count == this.LstChkBoxes.Count)
nmbrsAdded = true;
}
}
for (int i = 0; i < this.LstChkBoxes.Count; i++)
{
myCheckBoxList.Items.Add(new ListItem(this.LstChkBoxes[lstRandom[i]].sText, this.LstChkBoxes[lstRandom[i]].nAlternatives.ToString()));
}
}
else
{
for (int i = 0; i < this.LstChkBoxes.Count; i++)
{
myCheckBoxList.Items.Add(new ListItem(this.LstChkBoxes[i].sText, this.LstChkBoxes[i].nAlternatives.ToString()));
}
}
if (this.bBorder)
{
myCheckBoxList.BorderStyle = BorderStyle.Solid;
myCheckBoxList.BorderColor = Color.Black;
myCheckBoxList.BorderWidth = Unit.Pixel(2);
}
if ((Lwfont.LocalFontStyle & 1) != 0)
myCheckBoxList.Font.Bold = true;
if ((Lwfont.LocalFontStyle & 2) != 0)
myCheckBoxList.Font.Italic = true;
if ((Lwfont.LocalFontStyle & 4) != 0)
myCheckBoxList.Font.Underline = true;
if ((Lwfont.LocalFontStyle & 8) != 0)
myCheckBoxList.Font.Strikeout = true;
if (this.lwfont.LocalFontName != null)
{
myCheckBoxList.Font.Name = this.Lwfont.LocalFontName.ToString();
myCheckBoxList.Font.Size = lwfont.LocalFontSize;
myCheckBoxList.ForeColor = ColorTranslator.FromWin32((int)Lwfont.LocalFontColor);
}
else
{
Test test = new Test();
test = HttpContext.Current.Session["test"] as Test;
myCheckBoxList.Font.Name = test.SfontName;
myCheckBoxList.ForeColor = ColorTranslator.FromWin32((int)test.IfontColor);
}
int height = this.IBottom - this.ITop;
int width = this.IRight - this.ILeft;
myCheckBoxList.Width = width;
myCheckBoxList.Height = height;
return myCheckBoxList;
}
|
|
|
|
|
hi,
sory for the late reply,
what happens if you set the selected values again, in the for loop where u r adding them?
<pre>
if (this.LstChkBoxes.Items[i].Selected == true)
{
myCheckBoxList.Items.FindByValue(this.LstChkBoxes[i].nAlternatives.ToString()).Selected = true;
}
</pre>
|
|
|
|
|
I don't know how to do that in an easy way. I will simply try another solution and abandon this one...
Thanks anyway
|
|
|
|
|
Are you randomising the text of the Checkboxes or the actual Checkbox objects?
|
|
|
|
|
or you can give me any website demo using asp.net..
|
|
|
|
|
|
|
Hi,
I m currently developing a project on Xml Editor in vb.net...While trying to validate the xml against dtd i m getting the following error :
XmlValidatingReader is obsolete.
I tried using XmlReaderSettings but its showing an error saying that "The XmlSchemaSet on the document is either null or has no schemas in it. Provide schema information before calling Validate."
This is the coding i ve written :
Dim xmlV As New XmlDocument
Dim xmlP As New XmlTextReader(TempFile)
Dim settings As New XmlReaderSettings
Dim eventhandler As ValidationEventHandler
eventhandler = New ValidationEventHandler(AddressOf WriteErrorLog)
xmlV.Validate(eventhandler)
settings.ValidationType = ValidationType.DTD
settings.ProhibitDtd = False
Dim reader As XmlReader
reader = XmlReader.Create(xmlP, settings)
xmlV.Load(reader)
ErrStr = ""
ListBox1.Items.Clear()
IsValid = True
Do
Try
If reader.Read() Then
lineInf = CType(xmlV, IXmlLineInfo)
End If
Catch exx As Exception
Try
IsValid = False
If lineInf.HasLineInfo Then
ErrStr = lineInf.LineNumber.ToString + ": " + lineInf.LinePosition.ToString + " " + exx.Message
End If
If exx.Message.IndexOf("EndElement") > 1 Then
Exit Do
End If
ListBox1.Items.Add(ErrStr)
Catch eeex As Exception
MsgBox("Some unexpected error occurred " + vbNewLine + eeex.Message, MsgBoxStyle.Information, "Error")
Exit Do
End Try
End Try
Loop While Not xmlP.EOF
reader.Close()
xmlP.Close()
Me.Cursor = System.Windows.Forms.Cursors.Default
If IsValid = False Then
MsgBox("File is not valid", MsgBoxStyle.Exclamation, "Error")
Else
MsgBox("File is valid", MsgBoxStyle.Information, "OK")
End If
End Sub
Can anyone pls help me out in finding the error??? THanks in advance.
|
|
|
|
|
we use lightbox for showing the image in another div with large size & some animation effect. suppose there are few links in my page and when user click on any link then i will show employee image with the help of lightbox. but my problem is i need to show few other info with the image in same div generated by lightbox. lightbox is showing only image. can anyone guide me to show my other info in the same div where lightbox is showing the image.
please help me with concept.
thanks in advance.tbhattacharjee
|
|
|
|
|
How can I reduce exactly 6 months from a specific date?
|
|
|
|
|
Assuming that you don't need to bother about Time zones, Day light savings etc., you can use the AddMonths method of the DateTime instance.
You just need to pass negative value to subtract and positive value to add.
MSDN listing for AddMonths method[^]
HTH!
|
|
|
|
|
|
I dont know is this posible in asp.net but you try this with Sql
'Select DateAdd(month,-6,'03/06/2010')'
Output :'2009-09-06 00:00:00.000'
|
|
|
|
|
DateTime specificdate= DateTime.Now;
specificdate.AddMonths(-6);
|
|
|
|
|
In ASP Dot Net, I want to do trend anaylsis and want to use some control that result in graph/chart form. i dont want to use crystal report charting. Is there any light weight 3rd party control(Free) that can help me.
|
|
|
|
|
Use sql report viewer control its free and its allow to create charting reports( you do not need to install sql reporting to use sql report viewer)
|
|
|
|
|
but i want to use asp dot net
|
|
|
|
|
Report viewer control is part of asp.net just have look once or google it.
|
|
|
|
|
Hi, you can try ZedGraph. Good luck!
|
|
|
|
|
I have a series of functions for manipulating strings, doing route distance calculations......
In ASP I wuold have placed them in an include file, linked the file and that was it.
Can anyone help me do the same in ASP.net? Where do I store them and how do I attach them so I can call them, idealy as a strongly typed item?
Many thanks
John
|
|
|
|
|
Why not put all of your methods in a class library. If all they do is take in a string, change it, and spit it back out you can make the methods static and you don't have to instantiate any classes to use them. Don't blame me. I voted for Chuck Norris.
|
|
|
|