|
Some of you might be aware of my plight (http://www.readytogiveup.com[^]) and that site is set up using a Microsoft ASP Starter Kit. Would any of you know a simple fast way that I can allow people to append comments under each page and just let those comments paginate below the pages? If you do would be willing to help me implement that or do it on one page so I can replicate it to the others? I've got so much to do to the site as some bigger companies like SQLServerCentral are wanting to get involved and I really want to get that site styled out so that it's ready to go.
Let me know A) How I would do it and B) if you can help. Obviously A) is the most important.
Thanks,
Rex
|
|
|
|
|
It's pretty simple to create a paged list, using a gridview or other control. Obviously, you need a database on the back end storing the comments, etc. If you want to replicate the functionality, write it as a control, if you want different comments on different pages, add a forumId to your database table, and make it a property of the control.
Let me know if you need any more help with this, I'm happy to put it together for you, if you're not sure how to go about it.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Sounds like a great thing to do in my spare time. Give me one afternoon to come up with a simple extension. Good site btw.
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
My blog
|
|
|
|
|
I have one page in which i put Iframe.
i have one dropwownlist control in iframe and one submit button in page.
also i have one hidden field called h_locale.
Now i want to get the selected value of dropdownlist in hidden field using javascipt on click of submit button.
I am doing following code.Its working fine in IE but i am getting problem in mozila broser.
My javascript code is here
<script language="JavaScript" type="text/javascript"><br />
<!--<br />
function getValues(){<br />
var x=document.getElementById("frame1").Document;<br />
document.getElementById("h_locale").value=x.getElementById("dd_country").value;<br />
}<br />
</script>
Plz help me out.
Thanks in advance
Pathan
GOD HELP THOSE WHO HELP THEMSELVES
|
|
|
|
|
Instead of document.getElementById try to use document.getElementsByName
and also in
i am not sure.. try this
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
You need to explicitly obtain the value of the selected item; try this:
function getValues(){
var x=document.getElementById("frame1").Document;
var lst = x.getElementById("dd_country");
document.getElementById("h_locale").value=lst.options[lst.selectedIndex].value;
}
cheers
Fred
|
|
|
|
|
I have been developing an ASP.net 2.0 web application that basically has login security. I have been struggling to get this thing to work. On my local machine it works fine, but when I copy the code (including the ASPNETDB.mdf that is in the APP_Data directory) over to a web server, I get to the login screen but when I attempt to login I get an error. Can someone please help me??? The error is listed below:
“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------
Failed to update database "C:\INETPUB\WWWROOT\APP_DATA\ASPNETDB.MDF" because the database is read-only.
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.
。
Exception Details: System.Data.SqlClient.SqlException: Failed to update database "C:\INETPUB\WWWROOT\APP_DATA\ASPNETDB.MDF" because the database is read-only.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): Failed to update database "C:\INETPUB\WWWROOT\APP_DATA\ASPNETDB.MDF" because the database is read-only.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +857434
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +735046
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +149
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +886
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +415
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135
System.Web.Security.SqlMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) +3612
System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser() +305
System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e) +105
System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +453
System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e) +149
System.Web.UI.WebControls.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) +17
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.42; ASP.NET 版本:2.0.50727.210
|
|
|
|
|
The ASPNETDB.mdf file is not really important, try to delete it off the web server, and see it that helps.
Unless you have used it for your login code, it should not matter.
HTH
|
|
|
|
|
I wish I could delete it, however this file is very important. I stored users' inormation in it. so is there any other way out?
|
|
|
|
|
You can check to see if the file is read only. Maybe you need write access to the directory on the web server?
Another way is to store usernames and passwords in the web.config file, this is an easy way to manage them and you can encrypt them too.
Cheers,
Peter Mead
http://www.petermeadit.net
|
|
|
|
|
the directory "wwwroot" on the web server is read-only, i've tried to change the property but I doesn;t work. Each time I changed it, it automatically turned to "read-only" the next time I brought up the propoty window,.... as to the database file in that directory, is not read-only.......
so.... i still get that error message...
|
|
|
|
|
Hello,
I am using the following code to upload and delete the file in a folder.
DirectoryInfo dir1 = new DirectoryInfo(Server.MapPath("~\\Upload\\"));
...
foreach (FileInfo f in dir1.GetFiles("*.jpg"))
{
byte[] buffer = new byte[f.OpenRead().Length];
f.OpenRead().Read(buffer, 0, (int)f.OpenRead().Length);
PhtMgr.AddPhoto(buffer);
f.Delete(); // Error occurs HERE.
}
This code is working fine for the firs time(first file). Its giving the following Error
"The process cannot access the file 'xyz.jpg' because it is being used by another process." when trying to upload another photo to database and delete it.
Plz let me know where i have side tracked.
Regards,
dhulipudi
|
|
|
|
|
Perhaps inserting
f.Close();
before the f.Delete() method will help...
If not, can you manually delete the file from Windows Explorer? If not, try re-booting...
Fred
|
|
|
|
|
Hi,
I am a Asp.net Developer(web developer), I am using Asp.net 2.0 framework with VB as language in visual studio 2005.
I have a dataset that has to be exported and opened with Excel 2007.
Main thing is the column header on the excel is not the datatable(dataset) column names, it is dynamically given according to the user selection on the previous screen
I was able to do that with couple or more method like CSV, XSLT and aslo directly from gridview
The Issue IS:
when ever I click the event to export into excel, As usually(regular) a window pops up and asks open, save and cancel. when I click open after that(Here is the issue occuring) excel prompts an window and tells that (Only in Excel 2007)
"The file you are trying to open, 'filename.xls'is in a different format than specified by the file extension, verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now"
when I click OK in that then it opens up
My user dont want to get that excel prompt window
I think it occurs due to the excel 2007 is designed XML format
Is there any way of doing this without excel prompt.
I would appreciate if suggest me with an example (code snippet).
For your information, I am pasting the code of all different method I tried.
CSV Method:
Protected Sub lbtn_exp_excel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lbtn_exp_excel.Click
Dt_RwSum = Obj_RightofWayBll.RwSum_Retrive(view_type, est_type, rwsum_fdate, rwsum_tdate) ' this is the datatable
Dim ds As New DataSet
ds.Tables.Add(Dt_RwSum)
'Dim drow As DataRow = ds.Tables(0).Rows
estdate_header = rwsum_etitle & " Date"
estamt_header = rwsum_etitle & " Amount"
Dim sb As New System.Text.StringBuilder
sb.Append(vbCrLf)
sb.Append("PROJECT No")
sb.Append(",")
sb.Append("Managing District")
sb.Append(",")
sb.Append("Location Description")
sb.Append(",")
sb.Append("Work Type")
sb.Append(",")
sb.Append(estdate_header)
sb.Append(",")
sb.Append(estamt_header)
sb.Append(vbCrLf)
Dim i As Integer
Dim j As Integer
Dim report As String = String.Empty
Dim sbdatarow As New System.Text.StringBuilder
For i = 0 To ds.Tables(0).Rows.Count - 1
Dim sb1 As New System.Text.StringBuilder
For j = 0 To ds.Tables(0).Columns.Count - 1
sb1.Append(ds.Tables(0).Rows(i)(j).ToString)
sb1.Append(",")
Next
criteria = sb1.ToString
sbdatarow.Append(criteria)
sbdatarow.Append(vbCrLf)
Next
Dim finalreport As String = sb.ToString & sbdatarow.ToString
Response.ContentType = ""
Response.AppendHeader("Content-Disposition", "inline;filename=ExcelReport.csv")
Response.Write(finalreport)
Response.End()
end sub
Gridview Methoddirectly exporting a gridview to excel)
Protected Sub lbl_exp_excel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lbl_exp_excel.Click
gv_excel.Visible = True
cesum_ptitle = Session("page_title")
Dim tw As New StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
Dim frm As HtmlForm = New HtmlForm()
Dim FileName As String = "BillingWorkSheet" & Date.Now.ToShortDateString
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("content-disposition", "attachment;filename =" & FileName & " report.xls")
Response.Charset = ""
EnableViewState = False
Controls.Add(frm)
frm.Controls.Add(gv_excel()) ' this is the gridview control
frm.RenderControl(hw)
Response.Write(tw.ToString())
Response.End()
End Sub
XSLT MethodStreaming the data from dataset to XSL file added in the project(excel_export.xsl))
Protected Sub lbtn_exp_excel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lbtn_exp_excel.Click
Dt_RwSum = Obj_RightofWayBll.RwSum_Retrive(view_type, est_type, rwsum_fdate, rwsum_tdate) ' this is the datatable
Dim ds As New DataSet
ds.Tables.Add(Dt_RwSum)
Response.ContentType = "application/vnd.ms-excel"
Response.Charset = ""
Dim xdd As XmlDataDocument = New XmlDataDocument(objDataset)
Dim xt As XslCompiledTransform = New XslCompiledTransform()
xt.Load(Server.MapPath("excel_export.xsl"))
xt.Transform(xdd, Nothing, Response.OutputStream)
Response.End()
end sub
I am tired of trying all the method, Please help me out to avoid that excel 2007 prompt window. My user is very strict in avoiding this prompt.
Thanks in advance
Mohamed
|
|
|
|
|
From the following code line
content-disposition to "attachment"
Remove content-disposition to attachment it will not ask you for the save/open dialog...
Try it out....
I was born dumb!!
Programming made me laugh !!!
--sid--
|
|
|
|
|
Hello All
How can i fetch the records from an excel sheet for a particular date.
i want to pass the date from frontend and fetch only those records which satisfy the condition.
my code is:----------
strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strFilePath + ";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"""
Dim cnCSV As New OleDbConnection(strConnectionString)
cnCSV.Open()
'Dim cmdSelect As New OleDbCommand("SELECT * FROM [sheet1$] where [Tube Dia]=22", cnCSV)
Dim cmdSelect As New OleDbCommand("SELECT * FROM [sheet1$] where [Invoice date]='14/04/2006'", cnCSV)
cmdSelect.CommandType = CommandType.Text
Dim daCSV As New OleDbDataAdapter
daCSV.SelectCommand = cmdSelect
Dim ds As New DataSet
daCSV.Fill(ds)
Oledb is treating my date as string
how to convert my string parameter('14/04/2006') to date.
|
|
|
|
|
Iam very good in OOP but ...
why Event of controls in asp.net defined as protected
aj123
|
|
|
|
|
I would guess it is because they didn't want anyone overriding them.
Ben
|
|
|
|
|
I'm pretty sure they don't necessarily have to be, thats just the way VS adds them in, no reason they couldn't be public (they can't be private as the page that ends up as a subclass of your code-behind has to access them).
|
|
|
|
|
A page class instance exists only for a single postback. As it has no persistence, nothing external is ever going to access the event, unless it's in a control, but the fact is, it cannot be private ( as the aspx is turned into a class DERIVED from the code behind ), and it shouldn't be public ( no external class should be calling an event handler )
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Hi everybody! I have a problem! I have some usercontrol, tell me how I can load each usercontrol when I need with only one palceholder?
Thanks!
THT
|
|
|
|
|
its very simple .............if u want one usercontrol ata time.
if u want to display one user control place it in a place holder when pageloads by keeping placeholder id and runat="server" attributes. and when the data changes place another usercontrol when needed.
Like
In source declare those usercontrols as <%@register and.............>
and place a placeholder with id and runat="server" attributes.
//Creating an instance of UserControl
usercontrols_UserControl1 uc = (usercontrols_UserControl1 )Page.LoadControl("usercontrols\\UserControl1 ");
//loading the user control dynamically
//assign the label text a value
phUserControl.Controls.Add(uc);
|
|
|
|
|
Hello,
How can I add dynamic controles to my web form at run time and working with its events and values.
Thanks.
Dad
|
|
|
|
|
TextBox txt = new TextBox();
Button btn = new Button();
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
btn.Text = "Test Button";
btn.Click += new EventHandler(btn_Click);
Page.Form.Controls.Add(txt);
Page.Form.Controls.Add(btn);
}
void btn_Click(object sender, EventArgs e)
{
btn.Text = txt.Text;
}
We Can Do Anything, If We Want It
|
|
|
|
|
Thanks that is great
but I want to add these controles when I click a button ,The probleme is that when the page come back from the server it lose all my controles.
so what can I do?
thanks .
Dad
|
|
|
|
|