|
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--
|
|
|
|
|
I 'm from China,my English is not perfect.
my question is:
how to export data to popwerpoint using vs2005 with c#?
thanks
modified on Wednesday, March 19, 2008 10:34 PM
|
|
|
|
|
You cannot export it to powerpoint.
Supported export types are "PDF","Image","Excel".
If you want it in powerpoint save it to image, open a powerpoint presentation and den save the image onto the ppt.
I was born dumb!!
Programming made me laugh !!!
--sid--
|
|
|
|
|
Hi,
I hope someone can help with with my problem, i have searched the Internet for information but i couldnt find any examples neither the answear.
I use NHibernate and c# for my asp.net site.
I have the "classic" problem. I have a dropdownlist with "Regions" and another one "Municipalities".
When I choose an item in the ddlRegions the appropiate municipalites should be shown in ddlMunicipalties. I cant get this to work, do anyone have a code that does this and could share it with me?
I have tried for a few evenings but i cant get it to work.
Thanks
Thommie
|
|
|
|
|
Hi Thommie,
I think your looking for somting like this:
private void ddlRegions_SelectedIndexChanged(object sender, System.EventArgs e)
{
RetrieveMunicipalities( int.Parse( ddlRegions.SelectedValue ) );
}
private void RetrieveMunicipalities( int region)
{
ddlMunicipalities.DataSource = Retrieve_Municipalities( region);
ddlMunicipalities.DataBind();
}
Greetins,
Marco van der Linden
|
|
|
|
|
Hi Marco,
Whats "= Retrieve_Municipalities( region)"?
is that a method to bind the data from the database?
can you please show me?
Thanks for the answear
Thommie
|
|
|
|
|
Hi Thommie,
Its a method that retrieve data from the database.
public DataTable Retrieve_Municipalities( int region)
{
string connectieString = ConfigurationSettings.AppSettings["ConnectieString"];
SqlConnection connectie = new SqlConnection(connectieString);
SqlCommand commando = new SqlCommand("spRetrieveMunicipalities", connectie);
SqlDataAdapter adapter = new SqlDataAdapter(commando);
commando.CommandType = CommandType.StoredProcedure;
SqlParameter parameterHoofdgroep = new SqlParameter("@region", SqlDbType.Int);
parameterregion.Value = region;
commando.Parameters.Add(parameterregion);
DataTable regions= new DataTable();
adapter.Fill(regions);
connectie.Close();
return regions;
}
Greetings,
Marco
|
|
|
|
|
Hi,
My code looks like this and it doesnt work:
This is with NHibernate.
The error code : fetchQ.ParamName = "Region.Id";
The error text: NHibernate.QueryException: Type mismatch in NHibernate.Expression.EqExpression: Region.Id expected type System.Int32, actual type System.String
RegionId in database is int. And the hbm file is mapped Int32
private void BindMunicipalities(int regionId)<br />
{<br />
try<br />
{<br />
<br />
string municipalityHql = "SELECT count(municipality.Id) from Municipality municipality WHERE municipality.Region.Id = :regionId";<br />
<br />
IList<query> queries = new List<query>();<br />
Query q = new Query();<br />
q.ParamInt = regionId;<br />
q.ParamName = "regionId";<br />
queries.Add(q);<br />
<br />
int municipalityCount = DataManagement.CoreRepository.RunCountStatement(municipalityHql, queries);<br />
<br />
if (municipalityCount > 0)<br />
{<br />
<br />
IList<query> fetchQueries = new List<query>();<br />
Query fetchQ = new Query();<br />
fetchQ.ParamName = "region.Id";<br />
fetchQ.ParamInt = regionId;<br />
fetchQ.ParamEvaluationType = EvaluationType.Equals;<br />
fetchQ.ParamString = string.Empty;<br />
fetchQueries.Add(fetchQ);<br />
<br />
IList<municipality> municipalities = DataManagement.CoreRepository.GetAll<municipality>(fetchQueries, 0, 0, true, "Name");<br />
ddlMunicipality.DataValueField = "Id";<br />
ddlMunicipality.DataTextField = "Name";<br />
ddlMunicipality.DataSource = municipalities;<br />
ddlMunicipality.DataBind();<br />
}<br />
}<br />
<br />
catch (Exception ex)<br />
{<br />
logger.Error("Failed to load municipalities.", ex);<br />
this.lblError.Visible = true;<br />
}<br />
<br />
}<br />
<br />
<br />
protected void ddlRegions_SelectedIndexChanged(object sender, EventArgs e)<br />
{<br />
<br />
this.BindMunicipalities(int.Parse(this.ddlRegions.SelectedValue));<br />
<br />
} <br />
</municipality></municipality></query></query></query></query>
modified on Thursday, March 20, 2008 5:16 PM
|
|
|
|
|
Is it possible to get the data out of a row before it is deleted in the gridview ?? I have implemented Gridview_RowDeleting event handler because I before this event fires before the actual delete occurs. I used the e.RowIndex where is e the GridviewDeleteEventArgs parameter of the function, and RowIndex is the row to be deleted.
however when i do a Gridview1.rows(e.rowindex).cells(1).text ... there is nothing in there. Yes there is data in the table. Same thing then i do cells(2) 0r cells(3). There are 19 columns in table.
Any suggestions on how i can get data pre - delete ?
|
|
|
|
|
Just in case anyone was wondering .... i solved my issue of getting the data out of a row about to be deleted.
Implement the RowDeleting event handler. Use the e.rowIndex where 'e' is the GridViewDeleteEventArgs parameter to the event handler, and 'rowindex' is the index of the row to be deleted. I passed e.rowindex to the gridiew.rows() collection with returns a GridViewRow object. My gridview uses templated fields.
Using that object, call findcontrol passing in the id of the control in the row that you want to find. In my case it was a Label control. Then you will be able to grad whatever data you need out of that control
Protected Sub GridView1_Rowdeleting(ByVal sender as Object,ByVal e as System.Web.UI.WebControls.GridviewDeleteEventArgs ) Handles GridView1.RowDeleting
Dim lblName as Label = CTYPE(Gridview1.Rows(e.RowIndex).FindControl("Label1"),Label)
Dim name as String = lblName.Text
End Sub
|
|
|
|
|
Hi I’m developing an internet ASP.NET application, which needs to interact with Microsoft Certification Authority Server, the
client (browser) will request a certificate to sign a file (word, pdf) later.
I'm really disoriented. Must I use CAPICOM? Signing in the server, and sending the certificate through an SSL connection? Is
there any class in the .Net Framework to interact with Certification Authority Service without CAPICOM or an external Api?
Where can i get a code example?
Regards
Sergio
|
|
|
|
|
Don't cross post. Read the forum rules.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hey all,
I've refactoring a site of mine from VB.Net to C# and using a more structured OO design. I have the main solution with the web project and then another project for the BLL and DAL. I'm creating a additional security class in the BLL and I want to be able to access the context of the user but I'm having a bit of a brain freeze. I know it's the HTTPContext.Context.User class but how do I inherit the this in the BLL function I've created? I've tried HTTPContext.Context but then User is not available.
Any help provided would be greatly appreciated!
Thanks,
Adrian
|
|
|
|
|
Does this work:
HttpContext.Current.User.Identity.Name
Alexei Rodriguez
|
|
|
|
|
No, I did think that would be how I could access it from the BLL but it's not available for some reason.
Thanks for the suggestion though. Any other ideas?
Thanks,
|
|
|
|
|
I found the problem, basically I'm using a different project for my Business Logic so needed to import the System.Web assembly into the class to access the Httpcontext class. It's actually bad practice to use the httpcontext I guess as it then requires a web front end but in my case I'm going to use it anyway.
Regards,
Adrian
|
|
|
|