|
I am using Vista Ultimate and it is okay. Not great, not bad, just okay ( running it on a machine that is plenty able to handle it ). It all depends on how powerful of a machine you have.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Hi, when i am exporting gridview data to excel file, i am facing following error.. can any one give idea..why it so like this?
"Control 'GVExcel' of type 'GridView' must be placed inside a form tag with runat=server."
My code is as follows
mypage.aspx
<body> <form id="form1" runat="server"> <div> <asp:GridView ID="GVExcel" runat="server"> </asp:GridView> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div> </form></body>
Mypage.aspx.cs
string connstr = "Data Source=ORG33;Initial Catalog=MYDatabase;User ID=sa;Password=miller";
SqlConnection sqlcon = new SqlConnection(connstr);
sqlcon.Open();
string cmdcnt = "Select top 10 * from ORG_TBL_INDSEEDFirst";
SqlDataAdapter sqlda = new SqlDataAdapter(cmdcnt, sqlcon);
sqlda.Fill(ds);
dt = ds.Tables[0];
GVExcel.DataSource = dt;
GVExcel.DataBind();
StringWriter stringWrite = new StringWriter();
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
GVExcel.RenderControl(htmlWrite); ---Getting Error here
sqlcon.Close();
G. Satish
|
|
|
|
|
Try as below:
Response.Clear();
Response.AddHeader("content-disposition", "attachment;
filename=FileName.xls");
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite =
new HtmlTextWriter(stringWrite);
GridView1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Hi am a beginner in dotnet .Am creating a web application in asp vb.net .First i will tell what i want to accomplish
First i have a page when the user logins in to that site the page will display what all the tasks allocated to him in a datagrid
The datagrid has a check box for each of the rows being displayed.
and outside the datagrid there is a send button.When the user clicks the check box and then clicks the send button these datas must get displayed in the another datagrid which is present in another page.
What i have done in back end for this is:
When i check the check box and click the save button all the details will get inserted into the temp table and inside the temp table i have set a flag when the user checks the check box the flag will turn into "y" and the another datagrid which i want to display all the records will choose only the records where the flag is set to "y"
and the codes for it is as follows:
the SP on button click is as follows:
CREATE PROCEDURE USP_VIEW_TASK_UPDATE
(
@TASK_ID VARCHAR(5),
@TASK_ALLOC_DATE DATETIME,
@PROJ_ID VARCHAR(15),
@SUBMOD_ID VARCHAR(15),
@ACTIVITY VARCHAR(15),
@TASK_CREATE_BY VARCHAR(15),
@TASK_DETAILS VARCHAR(100),
@ASSOC_ID VARCHAR(15),
@SEND CHAR(1)
)
AS
BEGIN
CREATE TABLE UST_VIEW_TASK_TEMP
(
TASK_ID VARCHAR(5),
TASK_ALLOC_DATE DATETIME,
PROJ_ID VARCHAR(15),
SUBMOD_ID VARCHAR(15),
ACTIVITY VARCHAR(20),
TASK_CREATE_BY VARCHAR(15),
TASK_DETAILS VARCHAR(100),
SEND CHAR(1)
)
INSERT INTO UST_VIEW_TASK_TEMP VALUES
(
@TASK_ID,
@TASK_ALLOC_DATE,
@PROJ_ID,
@SUBMOD_ID,
@ACTIVITY,
@TASK_CREATE_BY,
@TASK_DETAILS,
@SEND
)
SELECT
ALLO.TASK_ID,
ALLO.TASK_ALLOC_DATE,
HIST.PROJ_ID,
HIST.SUBMOD_ID,
HIST.ACTIVITY,
HIST.TASK_CREATE_BY,
ALLO.TASK_DETAILS,
'N'
FROM
UST_TASK_ALLOCATION ALLO,
UST_TASK_HISTORY HIST
WHERE
ASSOC_ID =@ASSOC_ID
AND convert(varchar,ALLO.TASK_ALLOC_DATE,112) =convert(varchar,getdate(),112)
AND HIST.TASK_ID=ALLO.TASK_ID
AND ALLO.TASK_ID=@TASK_ID
UPDATE UST_VIEW_TASK_TEMP SET SEND='Y'
WHERE
ASSOC_ID =@ASSOC_ID
AND HIST.TASK_ID=ALLO.TASK_ID
AND ALLO.TASK_ID=@TASK_ID
END
and the front end which i havedone on selecting a check box and the button click is:
Dim bsl As New BSL
Dim item As DataGridItem
Dim chkBox As CheckBox
Dim AllocatedDate As String
Dim taskid As String
Dim ProjID As String
Dim SubmodID As String
Dim Activity As String
Dim details As String
Dim CreateBy As String
Dim AssocID As String
Dim Connstr As String = "myconnectionstring"
For Each item In dgUserhometask.Items
chkBox = CType(item.FindControl("chkbox"), CheckBox)
If (chkBox.Checked) Then
AllocatedDate = CType(item.FindControl("lblAllocDate"), Label).Text.ToString
taskid = CType(item.FindControl("lblTID"), Label).Text.ToString
ProjID = CType(item.FindControl("lblPID"), Label).Text.ToString
SubmodID = CType(item.FindControl("lblMID"), Label).Text.ToString
Activity = CType(item.FindControl("lblActivity"), Label).Text.ToString
details = CType(item.FindControl("lblSynopsis"), Label).Text.ToString
CreateBy = CType(item.FindControl("lblAllocatedBy"), Label).Text.ToString
bsl.UserTaskStatus(Connstr, AllocatedDate, taskid, ProjID, SubmodID, Activity, details, CreateBy, AssocID)----->(UserTaskStatus is a function which will call the sp)
End If
Next
Dim ds As DataSet
dgUserhometask.DataSource = ds.Tables(0)
dgUserhometask.DataBind()
End Sub
UserTaskStatus function is as :
Public Function UserTaskStatus(ByVal Connstr As String, ByVal AllocatedDate As String, ByVal taskid As String, ByVal ProjID As String, ByVal SubmodID As String, ByVal Activity As String, ByVal details As String, ByVal CreateBy As String, ByVal AssocID As String) As DataSet
'To get the Connection String
Try
Dim objDataAccess As New DAL(Connstr)
Dim dsViewTask As DataSet
Dim strSQLScript As String = "USP_VIEW_TASK_UPDATE"
Dim strDatabaseServer As String = objDataAccess.DatabaseServer
With objDataAccess
.CreateSQLParmCollection(8)
If AllocatedDate = "" Then
.AddInParameter("@TASK_ALLOC_DATE", SqlDbType.DateTime, DBNull.Value, 1)
Else
.AddInParameter("@TASK_ALLOC_DATE", SqlDbType.DateTime, AllocatedDate, 1)
End If
.AddInParameter("@TASK_ID", SqlDbType.VarChar, taskid, 2)
.AddInParameter("@PROJ_ID", SqlDbType.VarChar, ProjID, 3)
.AddInParameter("@SUBMOD_ID", SqlDbType.VarChar, SubmodID, 4)
.AddInParameter("@ACTIVITY", SqlDbType.VarChar, SubmodID, 5)
.AddInParameter("@TASK_DETAILS", SqlDbType.VarChar, SubmodID, 6)
.AddInParameter("@TASK_CREATE_BY", SqlDbType.VarChar, SubmodID, 7)
.AddInParameter("@ASSOC_ID", SqlDbType.VarChar, AssocID, 8)
dsViewTask = .GetDataSet("USP_VIEW_TASK_UPDATE")
Return dsViewTask
End With
Catch ex As Exception
End Try
End Function
in the second page:
the sp which will be called after button click is:
create procedure USP_USER_VIEW_TASK
(
@ASSOC_ID VARCHAR(30),
@TASK_ID VARCHAR(5)
)
as
begin
SELECT * FROM UST_VIEW_TASK_TEMP
WHERE
SEND='Y'
AND ASSOC_ID =@ASSOC_ID
AND convert(varchar,TASK_ALLOC_DATE,112) =convert(varchar,getdate(),112)
AND TASK_ID=@TASK_ID
END
and the front end coding is for it is:
Dim Connstr As String = "myconnectionstring"
Dim bsl As New BSL
Dim AllocatedDate As String
Dim taskid As String
Dim AssocID As String
AssocID = Convert.ToString(Session.Item("Username"))
Dim dsViewHomeTask As New DataSet
dsViewHomeTask = bsl.ViewHomeTaskStatus(Connstr, AllocatedDate, taskid, AssocID)---->(View Home Task Status is a function which will call the SP)
If (dsViewHomeTask.Tables(0).Rows.Count > 0) Then
dgUpdtasksave.DataSource = dsViewHomeTask.Tables(0)
dgUpdtasksave.DataBind()
lblError.visible = False
Else
lblError.visible = True
dgUpdtasksend.ShowHeader = False
End If
View Home TaskStatus is a sfollows:
Public Function ViewHomeTaskStatus(ByVal Connstr As String, ByVal AllocatedDate As String, ByVal taskid As String, ByVal AssocID As String) As DataSet
'To get the Connection String
Try
Dim objDataAccess As New DAL(Connstr)
Dim dsViewTask As DataSet
Dim strSQLScript As String = "USP_USER_VIEW_TASK"
Dim strDatabaseServer As String = objDataAccess.DatabaseServer
With objDataAccess
.CreateSQLParmCollection(3)
If AllocatedDate = "" Then
.AddInParameter("@TASK_ALLOC_DATE", SqlDbType.DateTime, DBNull.Value, 3)
Else
.AddInParameter("@TASK_ALLOC_DATE", SqlDbType.DateTime, AllocatedDate, 3)
End If
'.AddInParameter("@PROJ_ID", SqlDbType.VarChar, ProjID, 3)
'.AddInParameter("@SUBMOD_ID", SqlDbType.VarChar, SubmodID, 4)
'.AddInParameter("@ACTIVITY", SqlDbType.VarChar, SubmodID, 5)
'.AddInParameter("@TASK_CREATE_BY", SqlDbType.VarChar, SubmodID, 6)
'.AddInParameter("@TASK_DETAILS", SqlDbType.VarChar, SubmodID, 7)
.AddInParameter("@TASK_ID", SqlDbType.VarChar, taskid, 2)
.AddInParameter("@ASSOC_ID", SqlDbType.VarChar, AssocID, 3)
dsViewTask = .GetDataSet("USP_USER_VIEW_TASK")
Return dsViewTask
End With
Catch ex As Exception
End Try
End Function
But when i click the check box and then the save button
its throwing an error "object reference not set to an instance of the object" in the place
If (dsViewHomeTask.Tables(0).Rows.Count > 0) Then
dgUpdtasksave.DataSource = dsViewHomeTask.Tables(0)
in the second page
The second page will show a message if there is no records to display when the user doesnt click the button even that it is not showing its throwing the same error for it .
Can anyone help me in sorting this out
modified on Wednesday, October 29, 2008 3:33 AM
|
|
|
|
|
Sounds like a complex task for a beginner - choose something easier, like working through a book.
Christian Graus
Driven to the arms of OSX by Vista.
"Iam doing the browsing center project in vb.net using c# coding" - this is why I don't answer questions much anymore. Oh, and Microsoft doesn't want me to.
|
|
|
|
|
Hi graus,
I have to do this and i want a help and not skipping from difficult things if u can help me
|
|
|
|
|
susan_151615 wrote: Catch ex As Exception
End Try
Don't just catch the exception and ignore it. If there is a problem, you won't get any notification about it, and you have no information about what it could be.
Comment out the Try..Catch code until you have got the code working. After that you can reintroduce it, with the addition of actually handling the exception in some way, e.g. displaying a message to the user.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi thank You,
after u mentioned it i wrote in catch
System.Diagnostics.Trace.WriteLine("[] Exception " & ex.Message)
after that i debugged it its throwing an error like this
"Object reference not set to an instance of an object."
in the same line which i entined before
|
|
|
|
|
Did you put that in the ViewHomeTaskStatus method?
The only reference that can be null in the code where you get the exception now, is the data set. It always has a Tables collection, if there was no tables you would get a different exception, and a table always has a Rows collection. So, the conclusion is that a data set is never returned from the method, and that only happens if there is an exception.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi i changed the way in which am getting the output i vchanged the getdataset into .Executescalar now
|
|
|
|
|
So the problem was in the GetDataSet method?
Did you change the exception handling? Did you find out what the actual problem was?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
No am not getting the output still nor able to find out the mistake
|
|
|
|
|
susan_151615 wrote: (View Home Task Status is a function which will call the SP)
Is there a problem with this function?
|
|
|
|
|
I think your way of approach is quite too complex for that task. If your aim is to show the rows that the user has checked in some other page, you could better take the ids of the checked rows, into a session variable and use a simple query just like the query which loads the grid in the first page with an extra where condition for the ids, so the ones that are selected alone will come. This should do ur task, it is strongly suggested that you dont take such values to database, just to show stuff in corresponding pages.
And infact you can even do this with no database hit (for this purpose) in the second page, just take all the values of the selected rows into a datatable and take that datatable to the next page through session, but the session size will become heavy.
Both the above ways are where your project allows to handle values in session, if that is not the case, you can try cookies too. and worst case your db method could help, and in your case, see whether the values u check are inserted in the table and use break points and see whether all the tables and rows that you want are in the dataset you are returned with.
|
|
|
|
|
HI ya what u r telling is correct .Since i dono how to implement that functionality and quite little bit tough am following this mehthod.And now my problem is no error is coming the SP is not working fine i think i dono whats the problem
the think in backend when i checked the SP its working through front end on button click the SP is not working fine
|
|
|
|
|
i am building a category tree like structure for my FAQ app. i need to show all active categories. The hitch is that
if a parent category is checked as inactive, then the sub or child categories under it should not be displayed even if they
are marked as active. I need a query which will return me such a resultset which i can display in a table. the columns in my
table are categoryid, category, ParentcategoryID,companyID and active. The ParentcategoryID contains id of another category
or 'No parentcategory' which denotes its the main category. It is easy to get the immediate parentcategory and find out if
its active or not. But to find out if that parent category's parent and so on is active or not is tough. please help.
|
|
|
|
|
HY
I m using de following code to send an email...
protected void btnSend_Click(object sender, EventArgs e)
{
Response.Write("hy");
MailMessage msg = new MailMessage();
msg.To = txtTo.Text;
msg.From = txtFrom.Text;
msg.Subject = txtSubject.Text;
msg.Body = txtContent.Value;
lblStatus.Text = "Sending...";
SmtpMail.SmtpServer = "smtp.gmail.com";
SmtpMail.Send(msg);
lblStatus.Text = "Sent email (" + txtSubject.Text + ") to " + txtTo.Text;
}
}
I dnt get a run time error......5305.7.0 MUST ISSUE STARTTLS COMMAND FIRST ....
plz help..
regards
modified on Wednesday, October 29, 2008 3:27 AM
|
|
|
|
|
I think the problem is the fact you are trying to use mail.hotmail.com try adding your Credentials to the sending, if not find a different SMTP Server
<br />
public Send Mail()<br />
{<br />
MailMessage message = new MailMessage("Send to Addr", "From Address", "Subject", "Message");<br />
message.IsBodyHtml = true;<br />
SmtpClient emailClient = new SmtpClient("Othe SMTP");<br />
emailClient.UseDefaultCredentials = false;<br />
System.Net.NetworkCredential basicAuthenticationInfo = new System.Net.NetworkCredential("YourSmtpUserName something@yourhost.com", "emailpassword");<br />
emailClient.Credentials = basicAuthenticationInfo;<br />
emailClient.Send(message);<br />
}<br />
|
|
|
|
|
Hy,thankz for replyng to my message....I had used aonther code ...
protected void btnSend_Click(object sender, EventArgs e)
{
Response.Write("hy");
MailMessage msg = new MailMessage();
msg.To = txtTo.Text;
msg.From = txtFrom.Text;
msg.Subject = txtSubject.Text;
msg.Body = txtContent.Value;
lblStatus.Text = "Sending...";
SmtpMail.SmtpServer = "smtp.gmail.com";
SmtpMail.Send(msg);
lblStatus.Text = "Sent email (" + txtSubject.Text + ") to " + txtTo.Text;
}
}
i get an error dat i sould issue an STARTTLS command first...can u recommend de changes dat i should make...
should i make any changes in de VIRTYAL SMTP SERVER and create a neew connection..
regards
|
|
|
|
|
Hi,
here is my code, which is same as your one. but not working as System.Net.Mail classes doesn't support SMTPS.
SmtpClient client = new SmtpClient("smtp.gmail.com", 465);
MailMessage mail_msg = new MailMessage();
MailAddress fromAdd = new MailAddress(tbFrom.Text.Trim());
mail_msg.From = fromAdd;
mail_msg.To.Add(new MailAddress(tbTo.Text.Trim()));
mail_msg.Subject = tbSubject.Text;
mail_msg.IsBodyHtml = true;
mail_msg.Body = "Message From: " + tbFrom.Text.Trim() + "Subject:" + tbSubject.Text.Trim() + "Email: " + tbTo.Text.Trim() + "Content: " + tbContent.Text.Trim();
System.Net.NetworkCredential basicCredential = new System.Net.NetworkCredential(tbFrom.Text, "my password");
client.EnableSsl = true;
client.UseDefaultCredentials = false;
client.Credentials = basicCredential;
client.Send(mail_msg);
Himanshu Manjarawala.
Sr. Software engineer @AutomationAnywhere
http://www.himanshumbi.blogspot.com
http://www.fieredotnet.wordpress.com
|
|
|
|
|
What .net Framework you using also add your account details to the smtpClient the code I gave you last answer works everytime.
|
|
|
|
|
Hi I am building a access restriction system into my logon and it work great for IPv4 only allow access to pcs with the following IP's 172.74.20.x but how does this work with IPv6? fe80::91da:172b:26fe:994d%10 ????
Thanks
|
|
|
|
|
I have two text box. one is for name and another for Address.
In name text box i want insert not more than 15 characters(alphabet). and in address I want insert 55 characters.
I use in name textbox:
D[a-zA-Z]*
It prints name in alphabet but it takes more than 15 characters.
Please guide me.
thanx
|
|
|
|
|
You should buy a book on regular expressions, or do some reading. There's a windows program called Expresso that will also help. You can enter as many chars as you like b/c that is exactly what the * means.
Christian Graus
Driven to the arms of OSX by Vista.
"Iam doing the browsing center project in vb.net using c# coding" - this is why I don't answer questions much anymore. Oh, and Microsoft doesn't want me to.
|
|
|
|
|
|