|
Thanks dude, that this is not what i wanted.
|
|
|
|
|
Then what do you want?
only two letters away from being an asset
|
|
|
|
|
AndieDu wrote: lblUserMessage.Text = "Click on" + hlReportZip + "to download store status reports";
This will not work. To make that clickable, you need to render as a normal hyperlink.
lblUserMessage.Text = "Click on <a href=\"https://203.168.125.36\" /a> to download store status reports";
|
|
|
|
|
|
I have placed the Login, and LoginStatus in the MasterPage.
I have set LoginStatus to false by default.
Once the user has logged in, I want the LoginStatus to become True.
I have tried the following code and it's not working.
I tried to run the debugger and check if the code behind runs, and I haven't seen that it did. Seems that it just skips the code.
Thank you for your time.
MasterPage.Master
<asp:LoginStatus visible="false" CssClass="menu" ID="LoginStatus1" Font-Underline="true" runat="server"/>
<asp:Login OnLoggedIn="LoggedIn" ID="Login1" Width="600" runat="server" ...more code here >
MasterPage.Master.cs
protected void LoggedIn(object sender, EventArgs e)
{
LoginStatus1.Visible = true;
}
|
|
|
|
|
I think the MasterPage.Master runs that line <asp:LoginStatus visible="false" CssClass="menu" ID="LoginStatus1" Font-Underline="true" runat="server"/> again.
I would prefer using a session to store the login status
On the MasterPage.Master Page_Load event, do a check on the status of the Session("loginstatus") so if it's "1" then visible = true if it's "0" then visible = False. Henceforth, and your Login_Authentication you can check if user login success then chagne your session to "1" =)
Cheers hope this helps you~
|
|
|
|
|
Being fairly new to web development, i have an example project that runs against the adventureworks db. I have the db installed, can open it up with sql server (2005 developers edition) and can even test a connection using visualstudio server Explorer
In my projects code however I get access denied error message when the asp.net app tries to access the database. I am not using IIS for this, just the webserver that runs in Vstudio IDE when developing.
I suspect i don't have something setup for the database. I checked and Remote Connections are allowed
Here is ex.message
ex.Message "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)" string
The connection string looks like this
strConn =
get{return "Data Source=DALEHP\SQLDEVELOPER;Initial Catalog=AdventureWorks;Integrated Security=True";}
The connection section looks like this:
public static DataSet GetProducts(String strConn)
{
DataSet ds = null;
SqlConnection conn = null;
try
{
conn = ConnectionInfo.CreateConnection(strConn, true);
SqlCommand cmd = new SqlCommand("SELECT * FROM PRODUCTION.PRODUCT", conn);
SqlDataAdapter sqlDA = new SqlDataAdapter(cmd);
ds = new DataSet("Products_Set");
sqlDA.Fill(ds);
}
catch(SqlException ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
throw ex;
}
finally
{
ConnectionInfo.CloseConnection(conn);
}
return ds;
}
|
|
|
|
|
There are two ways of doing integrated sql security. If you want to set permissions for each user (which I don't recommend) make sure you go into IIS and uncheck the allow anonymous access box for your web application. You will also need
<authentication mode="Windows"/> in your web.config.
What I do in my applications is create one windows account that has access to the database. Use a system account so that no one can use that account to log on to the machine. Then add the following your web.config
<authentication mode="Windows"/>
<identity impersonate="true" userName="yourDomain\yourSQLAccountUserName" password="PA$$word"/>
Then make sure the yourDomain\yourSQLAccountUserName account has appropriate rights in the database. Then if you want to do auditing you can always pass the userName of your current user in a sql parameter and update the table.
Also put your conn string in the web.config and use system.configuration.configurationmanager to get it.
Another thing is that it is best to use using blocks. Then you don't have to call close or dispose methods.
For example
public DataTable GetDataTable(string ProcName, SqlParameter[] parameters)
{
DataTable dt = new DataTable();
using (SqlCommand cmd = new SqlCommand(ProcName))
{
cmd.CommandType = CommandType.StoredProcedure;
using (SqlConnection conn = new SqlConnection(connString))
{
cmd.Connection = conn;
foreach (SqlParameter prm in parameters)
{
cmd.Parameters.Add(prm);
}
SqlDataAdapter da = new SqlDataAdapter(cmd);
cmd.Connection.Open();
da.Fill(dt);
cmd.Parameters.Clear();
}
}
return dt;
}
I didn't get any requirements for the signature
|
|
|
|
|
Hi guys, how can I open a log.txt file inside the webform.aspx window. I don't open and display inside the TextPad. I tried googling but couldn't find something helpful may be you can redirect me to the helpful resource.
Thanks
|
|
|
|
|
System.IO.File.ReadAllText("C:\yourfilepath");
I didn't get any requirements for the signature
|
|
|
|
|
Thanks for suggestion some ways but that's not what I am looking forward, sorry.
Actually, I have a LinkButton on a aspx page and if that is cliked I want to open any kind of file like txt,bmp,jpg,gif,doc,xls files in an another browser window.
You probably have seen like when we open the .doc from hotmail it open the document file in a browser window same i want something like that.
Thanks once again in advance.
|
|
|
|
|
That should be easy enough. Where is the file coming from?
you need to add the content type to the page that will display the file depending on the file for example
switch ( fileExtension )
{
case "pdf": Response.ContentType = "application/pdf"; break;
case "swf": Response.ContentType = "application/x-shockwave-flash"; break;
case "gif": Response.ContentType = "image/gif"; break;
case "jpeg": Response.ContentType = "image/jpg"; break;
case "jpg": Response.ContentType = "image/jpg"; break;
case "png": Response.ContentType = "image/png"; break;
case "mp4": Response.ContentType = "video/mp4"; break;
case "mpeg": Response.ContentType = "video/mpeg"; break;
case "mov": Response.ContentType = "video/quicktime"; break;
case "wmv":
case "avi": Response.ContentType = "video/x-ms-wmv"; break;
//and so on
default: Response.ContentType = "application/octet-stream"; break;
}
Response.BinaryWrite(btyeArrayOfFile);
I didn't get any requirements for the signature
|
|
|
|
|
string fileContent = System.IO.File.ReadAllText("yourfilepath");
Response.Write(fileContent) This will work only for text files
|
|
|
|
|
Do you mean you want just the text in a
<div><p>...</p></div>
construct?
Or, why not simply use an asp:TextBox control and assign the contents of your text file to its Text property?
Mitchell
|
|
|
|
|
I have the following vb.net code to read the excel data into a dataset. The code works fine and the excel data is converted to a dataset. If the excel file has a data in the same column in which some numbers are formatted as text (eg. 080) and some numbers are not formatted as text but formatted as numbers (eg. 100.01) then the dataset contains empty values for the ones that are formatted as numbers. Is there anyway to get those values as text?
Thanks,
Bharathy.
Public Shared Function GetDataSetFromExcel(ByVal excelFileName As String) As DataSet
Dim con As OleDbConnection
Dim dt As DataTable
Dim conStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + excelFileName + ";Extended Properties=Excel 8.0;"
con = New OleDbConnection(conStr)
Try
con.Open()
dt = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, Nothing)
If (dt IsNot Nothing) Then
Dim excelSheetNames(dt.Rows.Count) As String
Dim i As Integer = 0
For Each row As DataRow In dt.Rows
excelSheetNames(i) = row("TABLE_NAME").ToString()
i = i + 1
Next
Dim myCommand As OleDbDataAdapter = New OleDbDataAdapter("SELECT * FROM [" + excelSheetNames(0) + "]", con)
Dim myDataSet As New DataSet()
myCommand.Fill(myDataSet)
Return myDataSet
Else
Return Nothing
End If
Catch ex As Exception
Throw (ex)
Finally
con.Close()
End Try
End Function
|
|
|
|
|
It sounds like this is an issue with the Excel driver attempting to guess the data type for the column. The driver has probably made the decision, based on sampling an initial number of rows (default is 8) that the column should contain text values. Values that look like they belong to another data type will be disregarded and show up as NULL. If you add the element 'IMEX=1' to your connection string this tells the driver to treat intermixed data in a column as text (see here[^])
If you need to increase the number of rows that the driver uses to guess the data type for a column, you need to make a registry change. See this article[^] for more information.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thanks a lot for your help. IMEX=1 did the trick.
|
|
|
|
|
Has anyone here played with this? I'm considering doing so, but I don't want to mess with it if it is vaporware or doesn't work outside of simple examples. What's the general impression of it? Has anyone run into any deal breakers with it that make you not want to use it?
Also, has anyone seen a situation where dynamic data handles hierarchical data (like groups that can contain other groups)?
Thanks,
Will
|
|
|
|
|
Can we dispose a datatable after use to free up the memory because it is huge in size
|
|
|
|
|
table = null;
mark it null so that when garbage collector runs it will free the memory
|
|
|
|
|
If it has a Dispose method, this should be called first. If not, then perhaps it shouldn't be a member variable, so it just gets disposed.
Hell, the page lifecycle means it will get removed unless it's stored in the session ( which would be stupid )
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
How to use group by in datatable in c#?
|
|
|
|
|
Hi,
I have placed a Telerik progress bar on my login page, this produces Javascript which makes calls to the Telerik.Web.UI.dll that is stored in the bin folder. However Forms Authentication is preventing access to this and producing JavaScript errors that 'telerik' is undefined. If I log into the site and go back to the login page it works fine.
Currently we have forms authentication set with the option path="/" meaning everything from the root down. Would it be better to have a new folder named "secure" and then any pages that need to have authetication sit under that folder, and change the forms authentication option to Path="/secure"?
Or is there a better solution?
Kind regards
Paul Custance
|
|
|
|
|
Hi,
I want to bind radio button with the database (MS Access). I have written some code.there are two radio buttons male and female. and one gender coloun in table yes/no (bool) type.
private void rbd()
{
try
{
database = new OleDbConnection(connectionString);
database.Open();
}
catch (OleDbException ex)
{
MessageBox.Show("Error in connection ..." + ex.Message);
}
string sqlStr = "SELECT * FROM city;";
dAdapter = new OleDbDataAdapter(sqlStr, connectionString);
dset = new DataSet();
dAdapter.Fill(dset,"city");
bindingSource = new BindingSource(dset, "gender");
radioButton1.DataBindings.Add("Checked", bindingSource, "gender");
radioButton2.DataBindings.Add("Checked", bindingSource, "gender");
during selection of radio button, i want to show data in grid based on selection??? any suggestions.
}
|
|
|
|
|
Are you binding city or gender?
Apurva Kaushal
|
|
|
|