|
N a v a n e e t h wrote: DateTime futureDate = DateTime.Parse(string.Format("3/31/{0}", DateTime.Now.Year + 1));
TimeSpan timeSpan = futureDate.Subtract(DateTime.Now);
int days = timeSpan.Days;
This one's going to cause you problems if it is currently Jan, Feb or Mar as then you dont want next march you want this march.
|
|
|
|
|
Yes you are correct. Need a checking.
|
|
|
|
|
SO, you asked this yesterday, and got two answers. You did not reply, so today the question was so urgent, you had to ask again, in the wrong forum ?
And your profile says you're an instructor/trainer ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
currently i m using ASP.NET with C# (.net 2003,1.1 framework).
when i click on a textbox, the default TEXT is to be get cleared.... how to achieve it? - KARAN
|
|
|
|
|
This can be done with JS. Hook OnClick javascript event, get the textbox object inside the event handler, and set value=""
|
|
|
|
|
|
Hi,
I dont know if this is the right forum for asking this,bear with me if its not.
I have a asp.net application that has a image file which needs to be replaced with a new image every time a user clicks a link.
Right now i am assigning the permissions(write/delete) on the server but the problem is, everytime there is an installation the permissions have to be manually supplied.
Could anyone provide an alternative approach may be to set the permissions through code....
thanks in advance...
I was born dumb!!
Programming made me laugh !!!
--sid--
|
|
|
|
|
sidbaruah wrote: i am assigning the permissions(write/delete) on the server but the problem is,
Are you assigning manually by taking the file properties ? Consider impersonation. Before writing, impersonate a user account which have read/write access to the file.
|
|
|
|
|
N a v a n e e t h wrote: Are you assigning manually by taking the file properties ?
Yes i am manually adding User account and setting read/write/delete permissions to true.
N a v a n e e t h wrote: Consider impersonation. Before writing, impersonate a user account which have read/write access to the file.
Is impersonation possible through the code because i wanted it without manually manipulating the permissions.
I was born dumb!!
Programming made me laugh !!!
--sid--
|
|
|
|
|
|
Thanks a lot.
I will try that.
I was born dumb!!
Programming made me laugh !!!
--sid--
|
|
|
|
|
i am using asp.net2.0 with c#.net
when update button is clicked i want a confirmation box , if the user presses ok i want to update the record
i have the following code in delete button code behind but i cannot get the result
ClientScript.RegisterStartupScript(typeof(Page), "pop", "<script language='javascript'>var ans=confirm('Do U Want To Update?');</script>");
if(ans==1)
{
connect = ConfigurationManager.AppSettings["connection"].ToString();
SqlConnection Sqlcon = new SqlConnection(connect);
string str = "update time set taskid='" + TextBox2.Text + "',platform='" + TextBox3.Text + "',projectname='" + TextBox4.Text + "',workdescription='" + TextBox5.Text + "',startdate='" + TextBox6.Text + "',enddate='" + TextBox7.Text + "',starttime='" + TextBox8.Text + "',endtime='" + TextBox9.Text + "',workstatus='" + TextBox10.Text + "'where sno='" + DropDownList1.SelectedItem.Text + "'";
Sqlcon.Open();
SqlCommand cmd = new SqlCommand(str, Sqlcon);
cmd.ExecuteNonQuery();
Sqlcon.Close();
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";
TextBox6.Text = "";
TextBox7.Text = "";
TextBox8.Text = "";
TextBox9.Text = "";
TextBox10.Text = "";
ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Data is updated');</script>");
}
it is showing error that ans does not exist in current content
|
|
|
|
|
You totally missed the concept. Keep it in mind, ASP.NET executes at the server and javascript at client. When you use ClientScript.RegisterStartupScript , supplied script is sent to the response and rendered in the page. You are seeing the confirmation message after ASP.NET finished it's processing. You need to consider the following alternatives
1 - Create a separate confirmation page with two buttons OK and Cancel. Write your code inside OK button. When user clicks the Update button, take him to the confirmation page.
2 - Use OnClientClick event of the button, hook a JS function which shows the confirmation and retuns.
|
|
|
|
|
Hi there,
I'm using TreeView control in one sample aspx page. It has one Parent Node and 3 child nodes. While running the application or in design page, that line is breaking and gap is visible in that web page. Please help me how to remove the Line Break?.
The code is:
<asp:TreeView ID="SampleTreeView" ShowLines="true" runat="server" ><br />
<Nodes><br />
<asp:TreeNode Value="Home" NavigateUrl="Home.aspx" ImageToolTip="1" Text="Home" Target="Content" Expanded="True"><br />
<asp:TreeNode Value="Page 1" ImageToolTip="Home" NavigateUrl="Page1.aspx" Text="Page1" Target="Content"><br />
<asp:TreeNode Value="Section 1" ImageToolTip="Section" NavigateUrl="Section1.aspx" Text="Section 1" Target="Content" /><br />
</asp:TreeNode><br />
<asp:TreeNode Value="Page 2" ImageToolTip="2" NavigateUrl="Page2.aspx" Text="Page 2" Target="Content"><br />
</asp:TreeNode><br />
<asp:TreeNode Value="Page 3" NavigateUrl="Page2.aspx" Text="Page 3" Target="Content"><br />
</asp:TreeNode><br />
</asp:TreeNode><br />
</Nodes><br />
</asp:TreeView>
Regards n Thks
Sam.M
modified on Thursday, March 20, 2008 1:49 AM
|
|
|
|
|
Have you solved this?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Hi All
I need to add mouseover event on hyperlink which is in a gridview.
What actually I need is displaying names of states in a gridview as hyperlink and when I take mouse over any state, it should navigate to a new page taking that stateid as querystring, So that I could request that stateid through query string and display information about that particular state in a newpage.
Any help is appreciated, Thanks in advance.
with Regards
wajid
|
|
|
|
|
Have you tried OnClientClick event of hyperlink control ?
|
|
|
|
|
Find the hyperlink column on itemdatabound event of grid and then add following attribut
lnkbutton.Attribute.Add("OnMouseOver","javascript:your function")
This will solve your problem..
Regards
Rahul
People Laugh on me Because i am Different but i Laugh on them
Because they all are same.
|
|
|
|
|
Or you can convet the field in to a template field having a href in the item template. Now you can easily associate your js function in the onmouseover event.
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
Dim strFileName As String = "prodrpt.xls"
Dim oStream As New MemoryStream
'oStream = MemoryStream
'oStream = CrystalReportViewer1.FilePath
oStream = Obj.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel)
Response.Clear()
Response.ClearContent()
Response.ClearHeaders()
Response.Buffer = True
Response.ContentType = "appliaction/vnd.ms-excel"
Response.AddHeader("Content-Disposition", "attachment; filename=""" & strFileName & """")
Response.BinaryWrite(oStream.ToArray())
Response.Flush()
Response.End()
i use this code to export the crystal report in excel it work,but it will export all the data which is present in database.
but i want all record which is present in crystal report.
urgent...........thanks in advance
|
|
|
|
|
Hi
Try this, might need some fine tuning to work for you.
'declare crystal variable
Dim diskOpts As New CrystalDecisions.Shared.DiskFileDestinationOptions
Dim exportOpts As New CrystalDecisions.Shared.ExportOptions
'set export option - change WordForWindows to Excel
' set output file name
exportOpts.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.WordForWindows
exportOpts.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.DiskFile
diskOpts.DiskFileName = "FILENAME"
'declare your crystal report
'populate report - i am using a datatable
'export report
Dim oRpt As New rptCustomerData
oRpt.SetDataSource(dtCust)
exportOpts.ExportDestinationOptions = diskOpts
oRpt.Export(exportOpts)
hope this helps, didn't have much time to adjust it to your req.
Anoop
|
|
|
|
|
|
Hi!!
I am running an application which is developed in VS2 Beta version in VS2.. Everything is fine except Reports.. When i run reports i am getting an error like "Failed to load database information. Details: The database DLL 'crdb_fielddef.dll' could not be loaded. Error in File C:\DOCUME~1\USHA~1.SNI\LOCALS~1\Temp\registrations {A2A0D120-17C0-49B3-A8AD-8F27D24A9C59}.rpt: Failed to load database information."
I am using 'ttx' files to generate Report.. If i dont use 'ttx' file its working fine.. please tel me the solution for my problem?
|
|
|
|
|
Hi,
I am trying to achive the following. Have a loop which goes through a list of suppliers for each supplier a report is created to show their orders (but the report does not need to be displayed on the screen) the report is then rendered into a pdf and emailed to the supplier.
This is what i have done. I have created a local report using the wizard. Created the data set then created the data source for the reportviewer control as an objectdatasource. Placed a loop inside the page load. Inside the loop i have set the paramerter for the objectdatasource to the name of the supplier.
Now if i dont use a loop and just display the report it will display correctly for the supplier that i set in the code and if i place the code to render to pdf and email inside a button it all works fine.
But i need to make it all automatic so on my page load i created a loop that first sets the supplier paramerter then calls the function to render to pdf and then email the report. But it gives an error when i try to render the report saying that the datasource for the report has not been set. I tried the code from the net that resets the reports clears it out of the page collection then creates a new reportviewer control and assign it the dataset but it does not work. I am thinking that because i am not displaying the report and trying to render it to pdf before it can get the date it is giving an error. I am pasting the code that i have tried any ideas ???
Me.ApplianceFax.Reset()
Dim oldViewer As Microsoft.Reporting.WebForms.ReportViewer
Dim oldIndex As New Int32
oldViewer = Me.ApplianceFax
Dim coll As New ControlCollection(Me)
coll = oldViewer.Parent.Controls
oldIndex = coll.IndexOf(oldViewer)
Dim ReportViewer1 As New Microsoft.Reporting.WebForms.ReportViewer
' Set Processing Mode
ReportViewer1.LocalReport.ReportPath = "Report2.rdlc"
ReportViewer1.ProcessingMode = ProcessingMode.Local
' Set reportviewer size
ReportViewer1.Height = New Unit("550px")
ReportViewer1.Width = New Unit("100%")
'ReportViewer1.ID = "ApplianceFax"
' Set default values
ReportViewer1.ShowExportControls = False
ReportViewer1.ShowBackButton = False
ReportViewer1.SizeToReportContent = True
' Reset the control collection position
coll.AddAt(oldIndex, ApplianceFax)
coll.Remove(oldViewer)
Me.ObjectDataSource1.SelectParameters("Supplier").DefaultValue = Supplier
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.DataSources.Add(New Microsoft.Reporting.WebForms.ReportDataSource("dsApplianceFaxTableAdapters.sp_ApplianceFaxReportTableAdapter", Me.ObjectDataSource1))
ReportViewer1.LocalReport.Refresh()
|
|
|
|
|
Reportviewer's dont use the new report source unless the page gets refreshed.
So if you want it to run into a loop it had to be response.redirected to the same page to create the next report.
I was born dumb!!
Programming made me laugh !!!
--sid--
|
|
|
|