|
I don't thik this is possible, as we don't have any control on client machine, any how if this is possible then it seems a big security issue.
Regards,
Prakash Kalakoti
|
|
|
|
|
To do that you need direct access to the client computer, and for that you need to use an ActiveX component that runs in the browser. This of course rules out all non-Windows operating systems.
---
single minded; short sighted; long gone;
|
|
|
|
|
Please write the ActiveX component name and how to use it.
|
|
|
|
|
Elena2006 wrote: Please write the ActiveX component name and how to use it.
I don't know of any specific component that does what you want. You have to decide exactly what it is that you want, and start looking around for components that do this.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi Elena
Did you ever find the solution to print without print dialog box in Java script ?
I'm in urgent need for it.
Thanks
Vishal Simon
|
|
|
|
|
Hi,
In an asp.net1.1 application I have a datagrid which was working but now its Command events (ButtonColumn and EditCommandColumn events )are not handled any more.The only change I made is adding a header and footer usercontrols.
Please any suggestion could be helpful.
I am too late but i will never give up
|
|
|
|
|
This is an issue with VS, if you open the page in design view some time the registered events gets removed automatically, so re-register your event.
Regards,
Prakash Kalakoti
|
|
|
|
|
Hi,
If you mean double click the event in the properties window then I did it already but no use.I have checked the event handling code (eventname+=new...) but every thing is ok.I forgot to mention that the datagrid is in a table cell (td) and the table is in a usercontrol.
I am too late but i will never give up
|
|
|
|
|
Hi,
As Prakash said, this is an issue with VS. I had faced similar problem just two days back. I had just clear the aspnet_wp.exe from the task manager, rebuild the application more than one times, then it got corrected. Try once more. it will work.
Best Wishes
Meeram395
|
|
|
|
|
Hello all,
i need to develop Content mgmt. system in ASP.NET/MySQL
any idea on how to start....?
|
|
|
|
|
I am trying to insert my COM Component into the toolbox of ASP.NET page using choose Items... but it is not embeddeding into the toolbox. sometimes it is visible in the tool box but in DISABLEd state.
How can I put my com component into the toolbox and make it Enable?
thnx in advance for suggestions
poojaaa
|
|
|
|
|
On Button Press, I am updating my userfeedback table certain columns, depending on who they are.
private void Button1_Click(object sender, System.EventArgs e)<br />
{<br />
bool bNoError =true;<br />
OleDbConnection con = new OleDbConnection(strConnection2);<br />
string strSQL;<br />
DataSet ds = new DataSet();<br />
CUsers user =new CUsers();<br />
user=(CUsers)Session["SessionUser"];<br />
switch(user.Role)<br />
{<br />
case "TL":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
strSQL="UPDATE UserFeedback set [TLComment]='"+TLComment.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"', [NeedAction]='"+NeedAction.Checked+"' WHERE autoNum="+autoNum.Text;<br />
break;<br />
case "CP":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
strSQL="UPDATE UserFeedback set [CPComment]='"+CPComment.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+autoNum.Text;<br />
break;<br />
<br />
case "ORA":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
strSQL="UPDATE UserFeedback set [ORAComments]='"+ORAComments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+autoNum.Text;<br />
break;<br />
<br />
case "DMO":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
strSQL="UPDATE UserFeedback set [DMComments]='"+DMComments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+autoNum.Text;<br />
break;<br />
<br />
case "User":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
strSQL="UPDATE UserFeedback set [Comments]='"+Comments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+autoNum.Text;<br />
break;<br />
} <br />
<br />
try<br />
{<br />
OleDbDataAdapter da = new OleDbDataAdapter(strSQL,strConnection2); <br />
<br />
da.Fill(ds);<br />
DataTable mytable =ds.Tables[0];<br />
DataRow myRow ; <br />
myRow = mytable.Rows[0];<br />
<br />
string n ;<br />
foreach(DataColumn c in mytable.Columns)<br />
{<br />
n = c.ColumnName;<br />
if(n=="RecNumber")<br />
{<br />
continue;<br />
}<br />
myRow[n] =ControlTypeCheck.CheckControlType(Page.FindControl(n),n);<br />
}<br />
OleDbCommandBuilder cb = new OleDbCommandBuilder(da);<br />
da.Update(ds);<br />
<br />
}<br />
catch(Exception err)<br />
{<br />
string str=err.Message;<br />
bNoError=false;<br />
}<br />
finally<br />
{<br />
con.Close();<br />
}
Debug Error
C:\DIMHRS\HelpDesk\UserFeedBack.aspx.cs(426): Use of unassigned local variable 'strSQL'<br />
|
|
|
|
|
string strSQL;
maybe make it string strSQL = string.Empty;
|
|
|
|
|
Bloops, forgot to post, I got it right after I posted here... Yes the answer was needing to make the string empty, I did so by
string strSQL="";
Actualy, onto the next step of debugging, and almost certain this is my last debug error
Update of the code:
private void Button1_Click(object sender, System.EventArgs e)<br />
{<br />
bool bNoError =true;<br />
OleDbConnection con = new OleDbConnection(strConnection2);<br />
string strSQL="";<br />
DataSet ds = new DataSet();<br />
CUsers user =new CUsers();<br />
user=(CUsers)Session["SessionUser"];<br />
switch(user.Role)<br />
{<br />
case "TL":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
strSQL="UPDATE UserFeedback set [TLComment]='"+TLComment.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"', [NeedAction]='"+NeedAction.Checked+"' WHERE autoNum="+TicketNum.Text;<br />
<br />
break;<br />
case "CP":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
strSQL="UPDATE UserFeedback set [CPComment]='"+CPComment.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text;<br />
break;<br />
<br />
case "ORA":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
strSQL="UPDATE UserFeedback set [ORAComments]='"+ORAComments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text;<br />
break;<br />
<br />
case "DMO":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
strSQL="UPDATE UserFeedback set [DMComments]='"+DMComments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text;<br />
break;<br />
<br />
case "User":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
strSQL="UPDATE UserFeedback set [Comments]='"+Comments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text;<br />
break;<br />
} <br />
<br />
try<br />
{<br />
OleDbDataAdapter da = new OleDbDataAdapter(strSQL,strConnection2); <br />
<br />
da.Fill(ds);<br />
DataTable mytable =ds.Tables[0];<br />
DataRow myRow ; <br />
myRow = mytable.Rows[0];<br />
<br />
string n ;<br />
foreach(DataColumn c in mytable.Columns)<br />
{<br />
n = c.ColumnName;<br />
if(n=="RecNumber")<br />
{<br />
continue;<br />
}<br />
myRow[n] =ControlTypeCheck.CheckControlType(Page.FindControl(n),n);<br />
}<br />
OleDbCommandBuilder cb = new OleDbCommandBuilder(da);<br />
da.Update(ds);<br />
<br />
}<br />
catch(Exception err)<br />
{<br />
string str=err.Message;<br />
bNoError=false;<br />
}<br />
finally<br />
{<br />
con.Close();<br />
}
Exception err is throwing
"Data type mismatch in criteria expression"
|
|
|
|
|
Why do people insist on catching errors they don't know how to handle then throw away useful information!
I would suspect that you shouldn't be getting a data type mismatch error at all, so why are you catching it here... Oh... I see because it it the button click event handler...
Why do you have database code in the presentation layer?! You'll be glad you don't work for the company I work for. It is written into out coding standards documentation that the use of data access code in a windows or web form is a sackable offence.
First, comment out the catch block. Find out exacly what is causing the exception and fix it.
|
|
|
|
|
This was surely not production code ? The giveaway is that the button is called Button1....
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
It wont be "production" for another 6 months. Again, though I bulid data collection websites for the govt. I have trained users, and on a secure server, that only my users have access too. The actual website, will be used for about 2 months, and then, never used again, and I will start another project.
|
|
|
|
|
1 - all your code is ripe for SQL injection attacks
2 - As has been said, you should never have DB code in your presentation layer
3 - As has been said, why catch exceptions and do nothing ?
4 - use string.Empty over "", as it's more efficient
5 - Give your controls meaningful names. When someone else looks at the code, how do they know which button was button1 ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: 4 - use string.Empty over "", as it's more efficient
Even better: assign null to the reference. That way if you try to use the value without assigning it a usable value, you will get a null reference exception instead of a cryptic error from the database.
Alternatively, add a default case in the switch, where you throw an appropriate exception. That way you don't have to assign anything to the variable before the switch statement, as the compiler knows that the variable always has a value when you exit the switch.
---
single minded; short sighted; long gone;
|
|
|
|
|
1. People have said this, but I still don't understand what they mean.
2. Why should you never have DB code in your presentation layer?
3. Actually, that is my most recent problem, the exception is catching an error, every value is updating the table, yet the exception err, is throwing "cannot find table 0"
4. I didn't even know you could do that, you would think the people that I work with that have degree's would code the write way, I guess not!
5. Eh, button1, I normaly do, this page actually only has one button it. I just hadn't gotten to renameing it.
Here is the most recent of my button1click,
private void Button1_Click(object sender, System.EventArgs e)<br />
{<br />
bool bNoError =true;<br />
OleDbConnection con = new OleDbConnection(strConnection2);<br />
string strSQL="";<br />
DataSet ds = new DataSet();<br />
CUsers user =new CUsers();<br />
user=(CUsers)Session["SessionUser"];<br />
switch(user.Role)<br />
{<br />
case "TL":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
else<br />
{<br />
TicketClosedBy.Text="";<br />
}<br />
<br />
<br />
strSQL="UPDATE UserFeedback set [TLComment]='"+TLComment.Text+"', [TLwho]='"+TLwho.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"', [NeedAction]='"+NeedAction.SelectedValue+"' WHERE autoNum="+TicketNum.Text;<br />
<br />
break;<br />
case "CP":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
strSQL="UPDATE UserFeedback set [CPComment]='"+CPComment.Text+"', [CPwho]='"+CPwho.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text;<br />
break;<br />
<br />
case "ORA":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
strSQL="UPDATE UserFeedback set [ORAComments]='"+ORAComments.Text+"', [ORAwho]='"+ORAwho.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text;<br />
break;<br />
<br />
case "DMO":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
strSQL="UPDATE UserFeedback set [DMComments]='"+DMComments.Text+"', [DMwho]='"+DMwho.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text;<br />
break;<br />
<br />
case "User":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
strSQL="UPDATE UserFeedback set [Comments]='"+Comments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text;<br />
break;<br />
} <br />
<br />
try<br />
{<br />
OleDbDataAdapter da = new OleDbDataAdapter(strSQL,strConnection2); <br />
<br />
da.Fill(ds);<br />
DataTable mytable =ds.Tables[0];<br />
DataRow myRow ; <br />
myRow = mytable.Rows[0];<br />
<br />
string n ;<br />
foreach(DataColumn c in mytable.Columns)<br />
{<br />
n = c.ColumnName;<br />
if(n=="autoNum")<br />
{<br />
continue;<br />
}<br />
myRow[n] =ControlTypeCheck.CheckControlType(Page.FindControl(n),n);<br />
}<br />
OleDbCommandBuilder cb = new OleDbCommandBuilder(da);<br />
da.Update(ds);<br />
<br />
}<br />
catch(Exception err)<br />
{<br />
string str=err.Message;<br />
bNoError=false;<br />
}<br />
finally<br />
{<br />
con.Close();<br />
}<br />
<br />
}<br />
}
Error is - Cannot find table 0.
|
|
|
|
|
Cannot find table 0. <br />
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <br />
<br />
Exception Details: System.IndexOutOfRangeException: Cannot find table 0.<br />
<br />
Source Error: <br />
<br />
<br />
Line 440: <br />
Line 441: da.Fill(ds);<br />
Line 442: DataTable mytable =ds.Tables[0];<br />
Line 443: DataRow myRow ; <br />
Line 444: myRow = mytable.Rows[0];<br />
<br />
<br />
Source File: c:\dimhrs\helpdesk\userfeedback.aspx.cs Line: 442 <br />
<br />
Stack Trace: <br />
<br />
<br />
[IndexOutOfRangeException: Cannot find table 0.]<br />
System.Data.DataTableCollection.get_Item(Int32 index)<br />
DIMHRS.HelpDesk.UserFeedBack.Button1_Click(Object sender, EventArgs e) in c:\dimhrs\helpdesk\userfeedback.aspx.cs:442<br />
System.Web.UI.WebControls.Button.OnClick(EventArgs e)<br />
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)<br />
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)<br />
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)<br />
System.Web.UI.Page.ProcessRequestMain()<br />
<br />
<br />
|
|
|
|
|
I rewrote the try, and also put in something to catch the Handle the Error.
private void UpdateFeedback_Click(object sender, System.EventArgs e)<br />
{<br />
bool bNoError =true;<br />
OleDbConnection con = new OleDbConnection(strConnection2);<br />
string strSQL="";<br />
DataSet ds = new DataSet();<br />
CUsers user =new CUsers();<br />
user=(CUsers)Session["SessionUser"];<br />
switch(user.Role)<br />
{<br />
case "TL":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
else<br />
{<br />
TicketClosedBy.Text="";<br />
}<br />
<br />
<br />
strSQL="UPDATE UserFeedback set [TLComment]='"+TLComment.Text+"', [TLwho]='"+TLwho.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"', [NeedAction]='"+NeedAction.SelectedValue+"' WHERE autoNum="+TicketNum.Text;<br />
<br />
break;<br />
case "CP":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
strSQL="UPDATE UserFeedback set [CPComment]='"+CPComment.Text+"', [CPwho]='"+CPwho.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text;<br />
break;<br />
<br />
case "ORA":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
strSQL="UPDATE UserFeedback set [ORAComments]='"+ORAComments.Text+"', [ORAwho]='"+ORAwho.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text;<br />
break;<br />
<br />
case "DMO":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
strSQL="UPDATE UserFeedback set [DMComments]='"+DMComments.Text+"', [DMwho]='"+DMwho.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text;<br />
break;<br />
<br />
case "User":<br />
if(TicketStatus.SelectedValue=="Closed")<br />
{<br />
string strStatus="Closed";<br />
TicketClosedBy.Text = strStatus; <br />
<br />
}<br />
strSQL="UPDATE UserFeedback set [Comments]='"+Comments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text;<br />
break;<br />
} <br />
<br />
try<br />
{<br />
OleDbCommand cmd = con.CreateCommand();<br />
cmd.CommandText=strSQL;<br />
con.Open();<br />
cmd.ExecuteNonQuery();<br />
}<br />
catch(Exception err)<br />
{<br />
string s= err.Message;<br />
bNoError=false;<br />
}<br />
finally<br />
{<br />
con.Close();<br />
}<br />
<br />
if(bNoError)<br />
{<br />
Response.Redirect("../HelpDesk/UserFeedback.aspx");<br />
}<br />
else<br />
HandleErrors();<br />
}<br />
}<br />
|
|
|
|
|
Dear all,
I managed to return a full hyperlink with query string values from a database as a string and i bound it to a grid view HyperLinkField
My problem is that i want it to open as a pop up when clicked not to navigate withing the same page
I know i should use the window.open javascr5ipt function but i don't know where should i put it
I would appreciate any help or hint
Best Regards
3ala2
|
|
|
|
|
If you are returning an anchor tag then you just need to set the target to _blank
<A HREF="yoururl" target="_blank">
Hope that helps.
Ben
|
|
|
|
|
i want a pop up window not a new window
Best Regards
3ala2
|
|
|
|
|