|
You could try replacing & with & in your string before reading it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
hi;
it is a remote xml.Ho can i replace it with &
|
|
|
|
|
I have a web application.
I want to be able to detect the user when they logoff. When they close the browser without logging off through our application. We are currently using a record in the database to track that user. We are able to handle this process if they logout normally through the app. Please help me on this issue.
Thanks in advance
Yrishi
|
|
|
|
|
Some times we need to detect the Browser Close to perform some operation before quiting from application. Here is a simple way.
function CheckBrowser()
{
if(window.event.clientX < 0 && window.event.clientY <0)
{
window.open("Operation.aspx",
"Operation",'left=12000,top=1200,width=10,height=1');
}
}
One Operation.aspx you can perform the database cleaning operation.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Thanks Abhijit,
actually i have tried this before, but it will not work if pop up are blocked at client side... do you have any idea on this....
|
|
|
|
|
You can make an AJAX call in that event, too. Of course, nothing you do is guarenteed to work, but an AJAX call will be more likely to work than a popup.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Thanks for your reply.
can you plz help me on AJAX Call...
|
|
|
|
|
yrishi wrote: can you plz help me on AJAX Call...
Please have a look :
AJAX database example[^]
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Hi Abhijit,
As we have discussed regarding "window.open". As we know, the only issue with this is if the pop up is blocked at client side then this will not
work. this can be also handle, my concern is, can we stop window.open on page refresh event... because if i refresh then also this code is
executing... Please reply.....
Thanks
Yrishi
|
|
|
|
|
Yes It will not work if popup is blocked. Please try to implement as CG suggested insted of opening a popup.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
we can detect the user if he log off from your application or when close the browser. If the net disconnect..then the real issue arise, in such condition it is difficult to detect the user
|
|
|
|
|
yesu prakash wrote: If the net disconnect..then the real issue arise, in such condition it is difficult to detect the user
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
|
The question he has asked that is nothing to do with the internet connection answer that you given. If you dont have the internet connection how will you access the Application.
Session maintianed on server end. So If user is inactive or Brower closed session will automatically timeout on server end on given timeout peroiod. But he want to clear the database data on that time. If his code is written on Session_End Event This will automatically fire for the user when session time out will reached to end.
Please correct me If I am wrong
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
modified on Wednesday, October 21, 2009 3:31 AM
|
|
|
|
|
Session_End will only fire for in-proc session provider.
Basically, there is no 100% perfect way to achieve the purpose he want.
|
|
|
|
|
string connection = ConfigurationManager.AppSettings["connectionstring"];
SqlConnection con = new SqlConnection(connection);
con.Open();
SqlCommand cmd = new SqlCommand("select place_name from place inner join state on place.state_id=state.state_id where state_name ='" + statedpdwnlist.SelectedItem.Value + "'", con);
dr = cmd.ExecuteReader();
con.close();
I cannot figure out why the above command is returning null value eventhough it is giving the desired output whn the same command is run on sql server query analyser.Can anybody help me with this??????( statedpdwnlist.SelectedItem.Value is coming correct in the query)
|
|
|
|
|
Have you copied the SQL in the debugger to make sure it's exactly right and works in QA ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Sorry I didn't see your reply before I post.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
*grin* probably because it wasn't there and you put more time in to your reply.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
myinstincts wrote: SqlCommand cmd = new SqlCommand("select place_name from place inner join state on place.state_id=state.state_id where state_name ='" + statedpdwnlist.SelectedItem.Value + "'", con);
Do like this :
string S="select place_name from place inner join state on place.state_id=state.state_id where state_name ='" + statedpdwnlist.SelectedItem.Value + "'"
SqlCommand cmd = new SqlCommand(s, con);
Now, Put a breakpoint on String S line, check the value of S. Then put the same string on SQL Server Query window and check the result. This will clear your doubts !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Hi,
I have hosted an application of ASP.NET 2.0 on my windows 2003 Server in wwwroot folder. During execuation application try to load some pdf from a directory and create document in it. "Document"
Application ASP.NET pages are working very much fine.
www.Myapplication.com/myfirstpage.aspx
but when i clicked on
link to open the PDF file in popup i expected to get this url on client machine browser.
http://www.MyApplication.com/documents/ABC123.pdf
but instead of above link it cusing problem and using following address
http://localhost/document/ABC123.pdf
I have ONLY Build (no Code). I have done this before as i was encoutered this situation before but i dont know i resolved that in past.
actually I was chaning some rights on different user like IIS_WPG and everyone?
Please give you thoughts and ideas about this issue,
Thanks,
Waleed
Waleed Butt, Software Engineer
Extended Innovation, Netsol
Tel: +92 (42) 111 44 88 00 | Fax: +92 (42) 570 1059 | Mobile: +92 (300) 4496414
E-Mail: buttw@extendedinnovation.com | Web: www.extendedinnovation.com
|
|
|
|
|
Hello,
This is my first time submitting a question ANYWHERE, please be kind to the noobie.
Situation:
• Creating a NOTING System for indivisual users
• Notes are stored in DB and retrieved for display on the web application
• Notes are grouped by Date entered
• Since notes can be lengthy an abbreviated notes is displayed
• A hover control is created to "show" the full note for reference/editing and deletion
• Nested Parent to Child controls are as follows
> PlaceHolder [ph_your_note] (static created on aspx presentation layer)
--- ALL dynamic cotrols are placed here ---
> pnl_main (created to house nested controls in one panel
> pnl_date (created to hold all notes of one date value)
> hvm_note ( hover control to show the sub panel that displays the full note)
> pnl_sub (created to hold the note header, textbox, update and delete image buttons )
> tb (text box that will be used to Display/Edit returned value of the
full note written to the database)
THIS IS THE CONTROL I AM LOOKING TO RETRIEVE THE VALUE FROM
What I currently know:
• The dynamically created Update Image Button is where I am trying to retrieve the tb.Text value (shown in code snippet below)
• I have located the value of the text box here, through QuickWatch
((System.Web.UI.WebControls.TextBox)(((System.Web.UI.WebControls.PlaceHolder)pnl_your_note.Controls._controls[0]).Controls[23].Controls[1].Controls[0].Controls[1])).Text
>Controls[23] is the varible that I need to determine how to dynamically call
Code snippets:
public void BindNotes()
{
DataSet ds = Execute_Notes();
string check_date = "";
string hold_date = "";
ph_your_note.Controls.Clear();
Panel pnl_main = new Panel();
pnl_main.ID = "pnl_notes_main";
int i = 0;
while (i < ds.Tables[0].Rows.Count)
{
HiddenField hf = new HiddenField();
hf.Value = ds.Tables[0].Rows[i]["Note_ID"].ToString();
notes_id = hf.Value.ToString();
Panel pnl_date = new Panel();
pnl_date.Attributes.Add("runat", "server");
pnl_date.ID = "pnl_date_" + hf.Value.ToString();
Panel pnl_sub = new Panel();
pnl_sub.Attributes.Add("runat", "server");
pnl_sub.ID = "pnl_sub_" + hf.Value.ToString();
pnl_sub.BorderWidth = Unit.Pixel(1);
pnl_sub.BorderStyle = BorderStyle.Solid;
pnl_sub.BorderColor = System.Drawing.ColorTranslator.FromHtml("black");
Label lbl_abbreviated = new Label();
lbl_abbreviated.Attributes.Add("runat", "server");
lbl_abbreviated.ID = "lbl_abbreviated" + hf.Value.ToString();
lbl_abbreviated.CssClass = "note_abreviated";
Label lbl_date = new Label();
lbl_date.Attributes.Add("runat", "server");
Label lbl_br = new Label();
lbl_br.Attributes.Add("runat", "server");
lbl_br.Text = "<br>";
Label lbl_edit = new Label();
lbl_edit.Attributes.Add("runat", "server");
lbl_edit.Text = "<center>view - update - remove <br></center>";
Label lbl_spacer = new Label();
lbl_spacer.Attributes.Add("runat", "server");
lbl_spacer.Text = " ";
if (ds.Tables[0].Rows[i]["Note"].ToString().Length > 22)
{
lbl_abbreviated.Text = " <img id='img_show' src='images/btn_icons/note_edit_16x.png' height='11px' /> " + ds.Tables[0].Rows[i]["Note"].ToString().Substring(0, 22) + ". . .";
}
else
{
lbl_abbreviated.Text = " <img id='img_show' src='images/btn_icons/note_edit_16x.png' height='11px' /> " + ds.Tables[0].Rows[i]["Note"].ToString();
}
check_date = Convert.ToDateTime(ds.Tables[0].Rows[i]["DATE_ENTERED"]).ToString("MMMM d, yyyy");
if (check_date != hold_date)
{
lbl_date.Text = " " + check_date.ToString() + "<br>";
lbl_date.CssClass = "note_date_seperator";
pnl_date.Controls.Add(lbl_date);
}
TextBox tb = new TextBox();
tb.Attributes.Add("runat", "server");
tb.TextMode = TextBoxMode.MultiLine;
tb.Width = Unit.Pixel(175);
tb.Height = Unit.Pixel(150);
tb.Text = ds.Tables[0].Rows[i]["Note"].ToString();
tb.ID = "tb_note_" + hf.Value.ToString();
tb.CssClass = "note_tb_format";
ImageButton img_btn_update_edit = new ImageButton();
img_btn_update_edit.Click += new ImageClickEventHandler(img_btn_update_note_Click);
img_btn_update_edit.ImageUrl = "images/btn_icons/note_accept_16x.png";
img_btn_update_edit.Attributes.Add("runat", "server");
img_btn_update_edit.ID = "note_" + hf.Value.ToString();
img_btn_update_edit.CssClass = "note_panel_icons";
img_btn_update_edit.ToolTip = hf.Value.ToString();
AttributeCollection note = img_btn_update_edit.Attributes;
ImageButton img_btn_remove = new ImageButton();
img_btn_remove.ImageUrl = "images/btn_icons/note_remove_16x.png";
img_btn_remove.CssClass = "note_panel_icons";
HoverMenuExtender hvm_note = new HoverMenuExtender();
hvm_note.TargetControlID += lbl_abbreviated.ID.ToString();
hvm_note.PopupControlID += pnl_sub.ID.ToString();
hvm_note.ID = "hvm_note_" + hf.Value.ToString();
hvm_note.OffsetX = 20;
hvm_note.PopDelay = 500;
pnl_date.Controls.Add(lbl_abbreviated);
pnl_date.Controls.Add(hvm_note);
pnl_sub.Controls.Add(lbl_edit);
pnl_sub.Controls.Add(tb);
pnl_sub.Controls.Add(lbl_br);
pnl_sub.Controls.Add(img_btn_update_edit);
pnl_sub.Controls.Add(img_btn_remove);
pnl_sub.CssClass = "note_sub_panel";
hvm_note.Controls.Add(pnl_sub);
ph_your_note.Controls.Add(pnl_date);
hold_date = check_date;
i++;
}
ph_your_note.Controls.Add(pnl_main);
}
protected void img_btn_update_note_Click(object sender, ImageClickEventArgs e)
{
notes_cmd = "update";
string ctrl_name = "tb_note_" + notes_id.ToString();
if (ctrl_name != String.Empty)
{
}
else
{
lbl_create_note.Text = "failed";
}
BindNotes();
}
A screen shot can be provided for viual eference if needed.
Thanks to anyone who can guide me to the answer.
Steve Crochet
Senior Application Developer
Ticketmaster
(and no I can't, I don't even get free tickets)
|
|
|
|
|
Steve Crochet wrote: string ctrl_name = "tb_note_" + notes_id.ToString();
so, ctrl_name can't EVER equal string.empty. Do you mean if notes_id.ToString is an empty string ? Where does notes_id come from ? Could it be null ?
Wait, this is not a web question. I would create a map that maps the notes_id itself to the control, so you can just look up the control, using the info you have at hand.
ARGH !! It IS a web question. I am confused. Yes, use FindControl to find the control.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian
• You are right about the ctrl_name, that was an attempt in the wrong direction.
• notes_id is never null, it is the UID from the database pertaining to that particular note
• I have tried the FindControl, but I am very UNclear on how to find that control 5 controls deep.
•• I have also made unique Ids for each control with the control name appended by the note_id
ex: pnl_sub_53
tb_53
hvm_note_53
(53 = note_id)
not sure why this is not a web question, and to your comment on mapping the note_id to the control, I assume that is what I am doing on the ID section (above ••).
one thing that I have noticed that the control elements are not visible to the img_btn_update_note_Click event How can I make them accessible to any or all CLICK events?
Steve
|
|
|
|
|
Steve Crochet wrote: I have tried the FindControl, but I am very UNclear on how to find that control 5 controls deep.
If FindControl does not work, perhaps you need to find the control at each level as you work your way down ?
Steve Crochet wrote: not sure why this is not a web question
I just read your C# part and suddenly thought I was in the C# forum. My bad, sorry.
Steve Crochet wrote: and to your comment on mapping the note_id to the control,
I meant building a map in memory, but that won't work, because you don't have any state.
Steve Crochet wrote: one thing that I have noticed that the control elements are not visible to the img_btn_update_note_Click event How can I make them accessible to any or all CLICK events?
How do you mean, not visible ? What elements are we talking about ?
Ultimately, you can iterate through the controls collection looking for controls if you know where they are.
I just looked at your code again. You call BindNotes ( which adds the control ) AFTER the code that's supposed to work with the control. If you're having to add the controls again in the same method, why not just pass the id you're looking for into that method and deal with it as you add it ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|