|
Turns out that I had a misconception about how to handle this. I did need to use the "~/" trick for accessing the script file, but it turns out that you can use Page.ResolveUrl to use it without making the <script> block runat=server. My main issue was that when I made it runat=server that the runtime was attempting to parse the javascript file.
|
|
|
|
|
I have a three tiered asp.net application and in my Student_Results class - I have my properties set up like this:
Public Property Enumerator()
Get
Return m_intenumerator
End Get
Set(ByVal Value)
m_intenumerator = Value
End Set
End Property
I have a text box where the intenumerator is taken from on another form a popup: the value is saved to the session variable and then the save function of the class uses a stored procedure to send the info into the table of the sql database. The field in the database is set up to accept nulls but I have an error hitting in the property as it will not accept the null value.
I have this on my popup form:
If Session("Marks") Is "" Then
m_objStudent_Results.Enumerator = System.Convert.DBNull
Else
m_objStudent_Results.Enumerator = CType(Session("Marks"), Integer)
End If
How do I deal with this problem - the text box being filled in is not mandatory - the end user can either put something there or not and if not I want the value of null set back the table.
thx, Tammy
|
|
|
|
|
Tammy, you need to test your session variable for empty string AND null... believe me when I say that I learned my lesson the hard way
Im comfortable with C#, so interpret this to VB syntax:
if (Session("Marks") != null && Session("Marks") != "")
{
//execute some instruction
}
else
{
//...now get the idea!
}
Nila Fridley
|
|
|
|
|
I'm embarrassed to say it but I can't spell to save my life some day's. Being a programmer this makes me look like a fool and even worse when I'm working with a web application. My boss has come to me and has asked me to find a solution to this issue of mine. I'm using VS 2005 Pro with the Adobe CS suit for misc. web and graphics features, plug-ins. Does anyone have an add-ins for VS 2005 for spelling within strings? My error messages, text within XSLT, and just in general.
I'm not having a bad hair day but a bad spelling day!
|
|
|
|
|
|
, it the strings and bodies of text. I get in a hurry and that all it takes. Thanks works great.
|
|
|
|
|
I've begun my GuestBook program's testing. It is a "WebSite" in terms of VS-2005. Home the program goes ok. But when I am using it through hosting, it fails. Maybe, the Internet needs something.
My website is http://hilsoft.qsh.ru
When enter, press above on LINKS
When will appear http://hilsoft.qsh.ru/Links.aspx - there is an inscription-link below "Guest Book Small". Go there, and you will see my problem. Home the new record is building ok. The texts of my program I am ready to send willingly. Please, help!
HilSoft
|
|
|
|
|
I have created a win32 DLL for my Web Application. I am using "DllImport( )" for importing the DLL file from the root directory of the Web Application. It works fine in the local machine ("localhost"). But when ever i Deploy my web application on web including the DLL and try to run the specified webform, then "Unable to load Dll" error message is returned back by the web server.
Can any one suggest anyting?
SMI
|
|
|
|
|
it could be path which when you deploy not recognised by app... or your DLL call another DLL method which is not there on deployment server.
sorry if its not the case.
Nav.
|
|
|
|
|
I have a free website that allows alumni of my high school to sign up and share information. It's like classmates.com, except it's free to alumni of my school (http://www.daviehighalumni.com[^] if you're interested).
There is one user who likes to cause problems by posting offensive messages on my message board, annoy other users, etc. I can easily block this user from signing in, but have no restrictions on creating new accounts, so they can easily create a new account and continue their behaviour.
I could try requiring e-mail authentication before a new account can be used, but this person could impersonate another alumni who doesn't yet have an account. I can't base it on IP address because they change often. I can't base it on name or e-mail address because a person can easily use a different name or create a new e-mail address.
Here's my last attempt to block this person: I put a tag on their profile so that when they logged in, I set a cookie on their computer. From then on, if I see this cookie, I don't let them log on or create new accounts. I thought this would keep them out for sure, but it hasn't worked as they apparently know how to delete cookies or are going to different computers.
So, does anyone have any ideas on blocking a user from accessing a web site when the web site is free and allows users to create accounts?
Barry Etter
|
|
|
|
|
you can set a message/post approve system which control by one or more site admins
Nav.
|
|
|
|
|
Yeah, I was gonna say the same thing too. He can also create a dictionary of offensive words/phrases, and create a utility of some kind that checks user inputs against that list as a pre-approval process. Just a suggestion!
Nila Fridley
|
|
|
|
|
IMHO, one of the ways is to provide a link, say Report Abuse, so that other members of the site can use to report it to the admin board. Also, to gain more attention from the gurus here, you might consider posting this question in the lounge (as I don't think it's a programming question ) where you can get a couple of golden tips from someone like the Lord Chris, code-frog, Andy Brummer ....
|
|
|
|
|
If your site is running on a Windows server, you could try parsing the output of...
nbtstat -A ipaddress
Jeremy Falcon
|
|
|
|
|
Hello all,
in asp.net 1.1 webform, in this form one gird, having 4 columns, one column is checkbox, rest of the 3 columns are having some data.
There is a button below the grid. when selecting a checkbox from grid & clicking on the button. my code is
foreach(DataGridItem dgi in datagrid1.Items) <br />
{<br />
string temp = dgi.Cells[2].Text <br />
}
my problem is temp string is displaying blank.
how to get the 2nd cell value?
regards
GV Ramana
|
|
|
|
|
use the DataBound event for getting the selected row and its values
Nav.
|
|
|
|
|
thx for reply
I have one button below the grid.
when clicking on that button i am getting the text of 2nd cell and doing some operation. for that i need.
How i will get?
plz tell me
regards
GV Ramana
|
|
|
|
|
you can get value in ItemDataBound event and save it to string and use it in any function you want to use you can get value in ItemDataBound like this.
CheckBox cb = CType(e.Item.Cells(0).Controls(0), CheckBox); <br />
if(cb.Checked == true) <br />
string temp = e.Item.Cells(2).Text.ToString();
Nav.
|
|
|
|
|
It looks like you are getting ALL the info for each row in the datagrid. This will overwrite string temp with the last row, which is the footer of the datagrid and therefore it will be blank.
You could test the checkbox in the forloop looking for the checkbox enabled
or / and
Have a string array and copy the cell information into the array
or
Use ItemDataBound on the row you wish to select to store the data.
Look where you want to go not where you don't want to crash.
Bikers Bible
|
|
|
|
|
Hi
plz understand my qtn. in my grid 2nd value field is name. with that name i am doing some operation
foreach(DataGridItem dgi in datagrid1.Items) <br />
{<br />
CheckBox chk = (CheckBox)dgi.Cells[0].FindControl("chkSelect");<br />
if(chk.Checked)<br />
{<br />
string sName = dgi.Cells[2].Text <br />
CallingAnotherFunction(sName);<br />
OneMoreOperation(sName);<br />
}<br />
}
this entire thing will happen when clicking on button.
my problem is i am getting everytime sName is blank.
regards
GV Ramana
|
|
|
|
|
How do you define the second column? Is it a bound column or a template column? Basically, you can use the Text property at a specific cell when the column is a bound column. If it is displayed via a control, you need to get reference to the control first, then get the value.
|
|
|
|
|
second column is template colummn in this i am binding like this
<ItemTemplate><br />
<%# DataBinder.Eval(Container.DataItem, "EMAIL")%><br />
</ItemTemplate>
plz tell e
regards
GV Ramana
|
|
|
|
|
Because you are using the data binding expression with the Template column, so the DataBoundLiteralControl is generated in each cell, and you need to cast the control in the Controls collection to this type before you access the Text property:
DataBoundLiteralControl lit = item.Cells[2].Controls[0] as DataBoundLiteralControl;
string value = lit.Text;
|
|
|
|
|
Hello All,
I'm trying to do a page which exports a table to Excel. But a set of statements gets printed on my page, when i try to export it again. The statements are:-
"Server: Microsoft-IIS/5.1 Date: Fri, 21 Jul 2006 11:32:11 GMT X-Powered-By: ASP.NET X-AspNet-Version: 1.1.4322 Content-Disposition: attachment; filename=FileName.xls Cache-Control: private Content-Type: application/octet-stream; charset=utf-8 Content-Length: 3908 "
At first i used "cache" instead of "viewstate".I thought cachewas making problems but all in vain.
Can anyone tell me what the problem is due to?
Thank you.
Regards,
Jeeva
My Code is:-
ViewState["DataTableExportToExcel"] = (DataTable)grdReportResult.DataSource;
private void ExportToExcel()
{
DataSet ds = new DataSet();
DataTable dt = new DataTable();
dt = (DataTable)ViewState["DataTableExportToExcel"];
ds.Tables.Add(dt.Copy());
clsGeneral objclsGeneral = new clsGeneral(); SaveExcel(objclsGeneral.SaveExcelToServer(ds,MapPath("Excell\\FileName.xls")));
//Procedure for exporting data to excel and save it into the server
//Cache.Remove("DataTableExportToExcel");
}
private void SaveExcelToClientMechine(string fileName)
{
System.IO.FileInfo targetFile = new System.IO.FileInfo(fileName);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + targetFile.Name);
Response.AddHeader("Content-Length", targetFile.Length.ToString()) ;
Response.ContentType = "application/octet-stream" ; Response.WriteFile(targetFile.FullName);
}
|
|
|
|
|
+ Using the ViewState to save the DataTable is not a good pratice as it's fit for the primitive stypes.
+ At the end of the SaveExcelToClientMechine method, you may try calling the Response.End method to avoid the html markup of the web page added to the output content.
|
|
|
|