|
Hi,
Im implementing a roulette like chat in asp.net and i having some issues about the logic.
The basic flow of the application should be :
1. user signed in to the site
2. user requesting someone to chat to
3. the request is sent to the server and the server draws a random user to chat to
4. the two user start communicating,
The problem i seem to have is that when a user request is reaching the server and the server tries to draw a new user to chat to (lets say from a DB) , how i synchronize that user with the drawn one, because its a multi-thread environment the user that i drew may also did the same function and tried to drew a user to.
So i will face a problem that the first user assigned to himself the other user and the other user may assigned to himself other user as well.
Is this a common problem? and if so what is the common solutions?
thank you.
|
|
|
|
|
Hi
I am making a modification to a web application using XPath, and when executed I get an error message - Invalid token!
This is basic what I am doing
public xmlNode GetSelection (SelectParams params, xmldocument docment)
{
xpathstring = string.format("Name =\'{0}' Displaytag = \'{1}' Manadatory=\'{2}', params.Name, params.Displaytag, params.Manadatory);
return document.selectsinglenode(xpathstring);
}
As you can see, I am making a string and setting values on the nodes I am trying to find against my xml document, and thus returning xml data that matches my parameters.
What is happening is that I am getting an xpathexeception error in Visual Studio and it says invalid token.
I do know that in the xml document that the parameters I am looking in the tags have double quotes, for example, Name="ABC". So, I thought the problem could be solved using an "\".
Can anyone help?
|
|
|
|
|
Hi,
As far as I can see, you're trying to escape a single quote, not a double quote.
Wouldn't be much more acute to use double quote for the construction of your XPath string ?
xpathstring = string.format("Name=\"{0}\" Displaytag=\"{1}\" Mandatory=\"{2}\"", params.Name, params.Displaytag, params.Mandatory);
Remark 1 : Was your code snippet weel-formed ? Because the way you showed it to us, compiler wouldn't even accept to compile (you never close the string with the closing double-quote).
Remark 2 : If you are escaping the first single-quote, why don't you escape the second also ?
Remark 3 : While debugging, could you test for the value of xpathstring ? What does it show ?
Remark 4 : When you publish some code, please take the time to format it well and use <pre> tag.
|
|
|
|
|
I want to know if I can get the content of a mail message from my inbox and store it into a string.
thank from advance.
|
|
|
|
|
I didn't understand your question. Mail message is itself as string type.
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|
|
|
you understood perfectly. is it possible to read form POP3 server only?
|
|
|
|
|
What do you mean? Doesn't the example read from POP3?
|
|
|
|
|
The example reads well, but I want to read mails from other server types(IMAP Server for example)
|
|
|
|
|
|
Hi,
I am trying to upload larger file (txt file size is 8 MB) in aspx page, for this i have made changes to web.config file
<httpRuntime executionTimeout="240" maxRequestLength="20480" />
When i try this page local it is working fine, the file is getting uploaded. When i tried to access this upload page URL from some other machine, pointing the url to my machine, i am getting timeout error. Please help me what is the problem here.
Thanks in Advance,
Regards,
priyaah.
|
|
|
|
|
I also face this problem earlier. My solution was first I save the file from the network drive to our local machine through our code and then upload it from the local machine.
Thanks
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|
|
|
is it possible to add a temporary data in bound dropdownlist?
i have dropdownlist with data from database
tblCode
Code CodeName<br />
1 AAAA<br />
2 BBBB<br />
3 CCCC<br />
4 DDDD
then sometimes user just put 0 in dropdownlist
just like in combobox in access, behaving like textbox.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
your question is not clear for me, can you please give me more info
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
ok. apologize.
here's the new question::
How can I make asp dropdownlist treat like combobox just the same in access?
In access, combobox is behaving like textbox meaning
you can input directly whatever you want.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
|
thanks. but i currently used this.
what i need is i want to input any data on the
dropdownlist which is not found in the database.
in your link given.
yes, i can type the letter,its good but what if
i will type numbers on dropdown or words that cannot be found on the dropdown.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
You should use AutoComplete extender control for this purpose.
Use this extender for a TextBox instead of a DropDownList. Populate the autocomplete data from the database.
Please have a look at the demo here[^].
|
|
|
|
|
Hi,
I have a checkbox inside a gridview which is bound to data at runtime except the checkbox templatefield.
At server side I am trying to capture the row details for the row which is selected. I get the checkbox but the checkbox.checked is always false even when it is selected.
protected void btnSelect_Click(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
CheckBox chk = (CheckBox)row.FindControl("chkAgency");
if (chk != null && chk.Checked)
{
Response.Cookies["thistestcookie"].Value = row.Cells[0].Text.ToString();
}
}
how do i get the checked checkbox row details ?!
Thanks,
Fifi
|
|
|
|
|
lets see the markup where you defined the checkbox ?
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
<Columns>
<asp:BoundField DataField = "Name1" HeaderText = "NAME" />
<asp:BoundField DataField ="Name2" HeaderText = "NAME2"/>
<asp:BoundField DataField = "Name3" HeaderText = "NAME3"/>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox id ="chkAgency" runat="server" Enabled />
</ItemTemplate>
</asp:TemplateField>
</Columns>
|
|
|
|
|
ok i see where your problem is. You assume if you add a checkbox, it will carry the ID of the checked field , that is not true. I normally create an extra template field and bind the label with the value and as you did on the server side, i find the label and get the value. I have compiled an example and this will help you
html
<asp:GridView ID="GridView1" AutoGenerateColumns="False" runat="server"
DataSourceID="SqlDataSource1">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkAgency" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="lblid" runat="server" Text='<%# Eval("ID")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField = "ID" HeaderText = "ID" InsertVisible="False"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField ="Descr" HeaderText = "Descr" SortExpression="Descr"/>
<asp:BoundField DataField = "LongName" HeaderText = "LongName"
SortExpression="LongName"/>
<asp:BoundField DataField="Capacity" HeaderText="Capacity"
SortExpression="Capacity" />
<asp:BoundField DataField="Note" HeaderText="Note" SortExpression="Note" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:TTBLv3MasterConnectionString %>"
SelectCommand="select * from dbo.TBL_VENUE"></asp:SqlDataSource>
<asp:Button ID="btntest" Text="Test" runat="server" onclick="btntest_Click" />
and the server side
protected void btntest_Click(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
CheckBox chk = (CheckBox)row.FindControl("chkAgency");
Label lblid = (Label)row.FindControl("lblid");
List<string> lstList = new List<string>();
if (chk != null && chk.Checked)
{
lstList.Add(lblid.Text);
}
}
}
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
I create a gridview with runtime columns. after that add textbox in this column.
Here the code.
protected void grdOne_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
TemplateField T = new TemplateField();
grdOne.Columns.Add(T);
GridViewRow gvr = e.Row;
TableCell tcell = new TableCell();
for (Int32 i = 0; i < columnCounter; i++)
{
TextBox tb = new TextBox();
tb.Width = 30; tb.Text = "0";
tb.ID = "tb_" + i.ToString();
tcell.Controls.Add(tb);
}
gvr.Cells.Add(tcell);
grdOne.Controls[0].Controls.AddAt(0, gvr);
}
}
But when i fetch textbox value from this grid that comes with error.
can any one tell me how to fetch textbox value from my grid
m using these line of code to fetch textbox values
public void GetArray(GridView grd)
{
String[,] ar = new String[rowCounter, columnCounter];
for (int i = 0; i < grd.Rows.Count; i++)
{
for( int j=1; j<= grd.Columns.Count; j++)
{
String tId = "grdOne_ctl03_tb_" + j.ToString();
String t = ((DataControlFieldCell)(grd.Rows[i].FindControl()).text;
}
}
}
|
|
|
|
|
Something issue with control Id, it's not able to find the exact control id. It may be issue with control hierarchy. I have some suggestion for you:
1. If you want to follow the same code then view the page source and see what is name of control id and under which parent control has created.
2. Other way, Create a template column at design time and put there a panel. On runtime find the panel and add the all textbox control inside the panel.
same way, during retrieval find the Panel and traverse the all child control.
Thanks,
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|