Showing posts with label control. Show all posts
Showing posts with label control. Show all posts

Thursday, March 29, 2012

Embedding a Report Within Page

Ok, I am getting extremely frustrated here, so I hope someone can help me.

I am trying to pass a parameter to a reportviewer control that is supposed to run a server report. This is how I am doing this:

Dim serverParams(0) As ReportParameter
serverParams(0) = New ReportParameter("RMAID", "3")
Me.RMAReport.ServerReport.ReportServerUrl = New Uri("http://MEDUSA/reportserver")
Me.RMAReport.ServerReport.ReportPath = "/CustomerServiceReports/RMAListingsById"
Me.RMAReport.ServerReport.SetParameters(serverParams)
Me.RMAReport.ServerReport.Refresh()


Now as far as I can tell this should work, but no matter what I do I get

Execution '' Cannot Be Found

Then I can not run any of the server reports at all, not just this one. Going to the reportserver I can run this report just fine. I just can't seem to get it so that this will render. Could someone please help me, I am about to go nuts!!!!

Thank you,

Josh

Ok, so I solved this problem by going from remote processing to local processing...I now have ran into another issue...I'll copy from my post over at the sql server 2005 forums where i have yet to receive a response....

Ok, I have been struggling with getting a report to run that I can pass parameters to for two days now, I have finally made progress on that front from going to local processing vs remote processing.

Now though I am about to pitch my computer underneath a truck if I don't get this solved shortly. I have two subreports as a part of this report. They aresupposedto be passed the id value as a parameter from the parent report. I found out that I still have to set data sources for these sub reports, so I attached the subreportprocessing event to the report viewer and attached the datasources that I created. My problem, I assume, is I don't understand how the dataset is supposed to be defined. I have tried three different ways. I built one dataset that has the relations to the two different tables that the sub reports use and built 3 distinct object data sources that reference the appropriate table adapters in the single dataset and I run the report.

Result I get every record in both tables for each record in the parent report

So next I tried creating three distinct datasets referencing the individual tables that the three reports would use (1 parent 2 child) and assign the datasources to the table adapters for the relevant reports and assigned them in the event.

Result I get every record in both tables for each record in the parent report

Finally I change the dataset to use a parameter to filter out the rows to only be the one for the relevant record in the report. I use the exact same name as the parameter that issupposedto be being passed from the parent report and assign accordingly in the subreportprocessing event

Result I get no error but I get no data either. I am assuming because it is not getting a parameter value.

I can find almost no information on this at all...I'm bashing my head on my desk yelling "WHY?"....this should not be this hard...please someone advise me in the proper direction. If you need any source samples please let me know....

|||

Does anyone have any ideas? I am running out of time to figure this out?

Thank you,

Josh

|||

Hello there:

In case you didn't play this drillthrough sample on:

http://www.gotreportviewer.com/

I am fighting for different issues with this reportviewer. It takes to long to figure out things that is supposed to be documented.

Good luck.

|||

I have spent a lot of time on that site, but it doesn't seem to have what I need.

Unfortunately I am not using drillthrough reports but just two sub reports...I implemented their sub reports exactly as they did except with sql instead of xml, but like I noted I return all results rather than the filtered results.

This truly should not be this hard....I have never wanted to go back to crystal reports until now....this is truly hurting my deadline...

Josh

|||

The reportviewer control is really meant to be used with local reports. Probably if you switched over to fully using the the report server or the reportviewer with local reports, you'll eliminate many of your difficulties.

|||

Hello again:

I look at the sample for the subreport and I found the way you assigned the parameter was different from the sample.

"Finally I change the dataset to use a parameter to filter out the rowsto only be the one for the relevant record in the report. I use theexact same name as the parameter that issupposedto be being passed from the parent report and assign accordingly in the subreportprocessing event"

Actually, you can assign the parameter through the property of the subreport: right click on your subreport> subreport Properties>Parameters: under this tab, you assign your parameter name and value. For example, mainID-- Field!mainID.Value.

I have read tons to find more about this control. I don't know whether this can fix your problem.

<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt"
Height="100%" Width="100%" AsyncRendering="False" SizeToReportContent="True">
<LocalReport ReportPath="YourMainReport.rdlc" OnSubreportProcessing="ReportViewer1_SubreportProcessing">
</LocalReport>
</rsweb:ReportViewer>

I think in OnSubreportProcessing you simply assign your subreport dataset to datasource. Another thing is to make sure the name of these datasets: yourDataset_yourDatatable. They have to be consistent with the definition in the source of your .rdlc files. You can check them to make sure.

I am close to get what I want to implement. I hope I can share with you with my findings.

|||

Limno,

You are right, I was doing it incorrectly. I solved my problem yesterday by a stroke of luck. You are right in the assumption that I was looking at the parameters incorrectly...I actually needed to pass all possible values to the sub report through the data source. I then needed to go in and make sure filtering was set up on the table that I was using to properly utilize the parameters passed to it. I wish this had been more clear in the documentation, or mentioned at all really, but it wasn't. Anyways, thank you for all of your help and if there is anything I can help with in your problem, please let me know!

Thanks,

Josh

Embedded VB.NET Code Limitations?

What are the limitations to using the Embedded VB.NET Code within a RDL?
Is it possible to control the IE Browser features via the Embedded Code?
JeffThere are no syntax limitations in VB code used in report expressions and
Code element. You can also call custom assemblies that must only be managed
but could be writting in VB, C# or even managed C++, etc...
If I correctly understand your question you want to write a code hosted
inside a report that will run on client and control browser via ActiveX
interface. This is not possible because all code inside report is always
executed on server and never passed back to the client for execution.
RS also does not support embedding scripts into HTML output. If it was
allowed it would be a security hole...
You can write your own application that will host IE Browser control and
will talk to report server to retrieve reports.
"Jeff" <Jeff@.discussions.microsoft.com> wrote in message
news:C762FC98-66B6-4358-9E91-28F2B3129475@.microsoft.com...
> What are the limitations to using the Embedded VB.NET Code within a RDL?
> Is it possible to control the IE Browser features via the Embedded Code?
> Jeff

Embedded or DB images not showing in ReportViewer

I have a report which has an embedded image in the heading and an image control that loads images from the database (Image control Data section configured as MIMEType=image/jpg, Source=Database, Value=Fields!Img_Data.Value).

In both cases I can see the embedded heading image and the database images in design mode (VS2005) and through the report manager web pages. When I try to render the report through the ReportViewer web control in my web application, the images do not display (standard missing image red "X" appears).

I have a button on my web form which re-runs the report and exports it to PDF, and when pressed the report is displayed correctly in PDF with all images.

What do I need to do to the ReportViewer web control for it to show embedded and database images? I am using the ReportViewer for 2005.

Please advise of give me some place to look.

Mark

Anyone?|||

Have the same problem.

Nowhere can find some answer.

Checked registration of http handler for reportViewer.

All seems ok.

But no one embedded image is not displayed.

We invested much time (read money) in the solution, and got stucked with this problem, because sorting images that uses reporting services dont display also.

If you found the solution, please help!

|||

I copied image URI from rendered report,

then tried to access embedded image from browser.

Copied url: http://localhost:2403/SITE/Reserved.ReportViewerWebControl.axd?ReportSession=w0bnfsz5qhowblqcixc22eix&ControlID=12fb7de86eea4d9080dda118312ed121&Culture=1049&UICulture=1049&ReportStack=2&OpType=ReportImage&StreamID=612c1bae-af83-408b-b385-25b08a827bc4

Result was Error

The stream cannot be found. The stream identifier that is provided to an operation cannot be located in the report server database. (rsStreamNotFound)

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: Microsoft.Reporting.WebForms.ReportServerException: The stream cannot be found. The stream identifier that is provided to an operation cannot be located in the report server database. (rsStreamNotFound)

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:

[ReportServerException: The stream cannot be found. The stream identifier that is provided to an operation cannot be located in the report server database. (rsStreamNotFound)] Microsoft.Reporting.WebForms.ServerReport.InternalRenderStream(String format, String streamId, String deviceInfo, String& mimeType, String& encoding) +216 Microsoft.Reporting.WebForms.ServerReportControlSource.GetStreamImage(String streamID, String deviceInfo, String& mimeType) +59 Microsoft.Reporting.WebForms.ReportImageOperation.GetStreamImage(String streamID, HttpResponse response) +216 Microsoft.Reporting.WebForms.ReportImageOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) +94 Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +215 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

Seems, that is ugly implementation bugSad

|||Solved the PROBLEM by installing SQL Server Service Pack 2.Smile)))|||

No, images showed only once, and then all goes wrong once again.

It's bad job that microsoft had done with this report controlSad((

SP2 dosnt solve this problem!

sql

Embedded or DB images not showing in ReportViewer

I have a report which has an embedded image in the heading and an image control that loads images from the database (Image control Data section configured as MIMEType=image/jpg, Source=Database, Value=Fields!Img_Data.Value).

In both cases I can see the embedded heading image and the database images in design mode (VS2005) and through the report manager web pages. When I try to render the report through the ReportViewer web control in my web application, the images do not display (standard missing image red "X" appears).

I have a button on my web form which re-runs the report and exports it to PDF, and when pressed the report is displayed correctly in PDF with all images.

What do I need to do to the ReportViewer web control for it to show embedded and database images? I am using the ReportViewer for 2005.

Please advise of give me some place to look.

Mark

Anyone?|||

Have the same problem.

Nowhere can find some answer.

Checked registration of http handler for reportViewer.

All seems ok.

But no one embedded image is not displayed.

We invested much time (read money) in the solution, and got stucked with this problem, because sorting images that uses reporting services dont display also.

If you found the solution, please help!

|||

I copied image URI from rendered report,

then tried to access embedded image from browser.

Copied url: http://localhost:2403/SITE/Reserved.ReportViewerWebControl.axd?ReportSession=w0bnfsz5qhowblqcixc22eix&ControlID=12fb7de86eea4d9080dda118312ed121&Culture=1049&UICulture=1049&ReportStack=2&OpType=ReportImage&StreamID=612c1bae-af83-408b-b385-25b08a827bc4

Result was Error

The stream cannot be found. The stream identifier that is provided to an operation cannot be located in the report server database. (rsStreamNotFound)

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: Microsoft.Reporting.WebForms.ReportServerException: The stream cannot be found. The stream identifier that is provided to an operation cannot be located in the report server database. (rsStreamNotFound)

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:

[ReportServerException: The stream cannot be found. The stream identifier that is provided to an operation cannot be located in the report server database. (rsStreamNotFound)] Microsoft.Reporting.WebForms.ServerReport.InternalRenderStream(String format, String streamId, String deviceInfo, String& mimeType, String& encoding) +216 Microsoft.Reporting.WebForms.ServerReportControlSource.GetStreamImage(String streamID, String deviceInfo, String& mimeType) +59 Microsoft.Reporting.WebForms.ReportImageOperation.GetStreamImage(String streamID, HttpResponse response) +216 Microsoft.Reporting.WebForms.ReportImageOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) +94 Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +215 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

Seems, that is ugly implementation bugSad

|||Solved the PROBLEM by installing SQL Server Service Pack 2.Smile)))|||

No, images showed only once, and then all goes wrong once again.

It's bad job that microsoft had done with this report controlSad((

SP2 dosnt solve this problem!

Tuesday, March 27, 2012

embedded control characters

Beyond my control: I am finding control characters (likely tab) is
making its way into address fields of our operational system. This is
messing me up when I load the data into our warehouse w/ BCP (fields
get shifted).
Is the a nifty way to strip control characters from data?
TIA
Robrcamarda (rcamarda@.cablespeed.com) writes:
> Beyond my control: I am finding control characters (likely tab) is
> making its way into address fields of our operational system. This is
> messing me up when I load the data into our warehouse w/ BCP (fields
> get shifted).
> Is the a nifty way to strip control characters from data?

UPDATE tbl
SET col = replace(col, char(9), ' ')
WHERE col LIKE '%' + char(9) + '%'

You could have to nest replace, if there are more characters you want
to kill.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Embeddale Report designer

Hi,
Is it possible to embedd Report designer into applications as an activeX
control?
Regds,
SapnilAssuming the wizard is an activex control instead of an exe... (I haven't
checked.)
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Sapnil" <Sapnil@.discussions.microsoft.com> wrote in message
news:5FF06443-76B8-40CD-8C66-FCDD79D07993@.microsoft.com...
> Hi,
> Is it possible to embedd Report designer into applications as an activeX
> control?
> Regds,
> Sapnil|||Technically it is possible, but other MS licenses would not allow you to do
this, I suspect RS is the same.
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Sapnil" <Sapnil@.discussions.microsoft.com> wrote in message
news:5FF06443-76B8-40CD-8C66-FCDD79D07993@.microsoft.com...
> Hi,
> Is it possible to embedd Report designer into applications as an activeX
> control?
> Regds,
> Sapnil

Thursday, March 22, 2012

email trigger

I'd like to setup a trigger to send an email, but can't use SQLMail because
I don't control the password to the account that is running the MSSQLSERVER
service. Is there any other way to have SQL send an email when an insert is
made to a particular table? Plus IT doesn't like the idea of Outlook
installed on a production server.You could use xp_smtp_mail. It requires that the ability to access a smtp
mail server. Quite 'safe' for a production server -unlike MAPI.
Mail -Sending
SQL 2000 - http://www.sqldev.net/xp/xpsmtp.htm
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Colin" <legendsfan@.spamhotmail.com> wrote in message
news:%23IQu$hjxGHA.3892@.TK2MSFTNGP03.phx.gbl...
> I'd like to setup a trigger to send an email, but can't use SQLMail
> because I don't control the password to the account that is running the
> MSSQLSERVER service. Is there any other way to have SQL send an email
> when an insert is made to a particular table? Plus IT doesn't like the
> idea of Outlook installed on a production server.
>|||Hi Colin
It is not really advisable to send emails from triggers as you will
potentially be increasing the transaction time significantly and therefore
increasing contention (blocking/deadlocking etc..). An alternative would be
to populate another table and then periodically have a process that emails
the information and clears the table down.
John
"Colin" wrote:
> I'd like to setup a trigger to send an email, but can't use SQLMail because
> I don't control the password to the account that is running the MSSQLSERVER
> service. Is there any other way to have SQL send an email when an insert is
> made to a particular table? Plus IT doesn't like the idea of Outlook
> installed on a production server.
>
>

email trigger

I'd like to setup a trigger to send an email, but can't use SQLMail because
I don't control the password to the account that is running the MSSQLSERVER
service. Is there any other way to have SQL send an email when an insert is
made to a particular table? Plus IT doesn't like the idea of Outlook
installed on a production server.You could use xp_smtp_mail. It requires that the ability to access a smtp
mail server. Quite 'safe' for a production server -unlike MAPI.
Mail -Sending
SQL 2000 - http://www.sqldev.net/xp/xpsmtp.htm
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Colin" <legendsfan@.spamhotmail.com> wrote in message
news:%23IQu$hjxGHA.3892@.TK2MSFTNGP03.phx.gbl...
> I'd like to setup a trigger to send an email, but can't use SQLMail
> because I don't control the password to the account that is running the
> MSSQLSERVER service. Is there any other way to have SQL send an email
> when an insert is made to a particular table? Plus IT doesn't like the
> idea of Outlook installed on a production server.
>|||Hi Colin
It is not really advisable to send emails from triggers as you will
potentially be increasing the transaction time significantly and therefore
increasing contention (blocking/deadlocking etc..). An alternative would be
to populate another table and then periodically have a process that emails
the information and clears the table down.
John
"Colin" wrote:

> I'd like to setup a trigger to send an email, but can't use SQLMail becaus
e
> I don't control the password to the account that is running the MSSQLSERVE
R
> service. Is there any other way to have SQL send an email when an insert
is
> made to a particular table? Plus IT doesn't like the idea of Outlook
> installed on a production server.
>
>

Sunday, March 11, 2012

Email Export?

Hello,

In the Crystal Report Viewer control, there is a way to export a report to the file format of choice (i.e. pdf or xls) and have it emailed.

This is probably a stupid question, but I have to ask it...

Is there a way to have an exported report in SSRS 2005 emailed without saving the report and then attaching it to an email?

I know about the scheduling services, but that will not work for me as my reports are created dynamically and displayed throught the ASP.NET 2.0 Report Viewer Control.

Thanks!!!

-Brian

Hi,

Have you tried Report Subscription using "Report Server E-mail" option? In BOL this is discussed under "E-Mail Delivery in Reporting Services". While configuring reports to be sent as an email you can include the report as a link or/and as an attachment.

HTH

Uday

|||

There is no supported email export. If you use the Viewer controls then your app could export the report and then send the email. Your app would have to take care of all smtp settings however.

-Daniel

|||

Thanks for the response Uday, but as noted in my original post, the report is created dynamically and not a published report. I cannot use the Scheduling/Subscription functionality...

-Brian

|||

Not built-into the ReportViewer control. Since you are sitting in code already, it is possible to wire this up really quickly using the classes in the System.Web.Mail namespace.

-Lukasz


This posting is provided "AS IS" with no warranties, and confers no rights.

|||

I am guessing I would need to use the ReportViewer's RenderStream method, but I cannot find good documentation on the parameters that are needed to call this method (i.e. streamId, mimeType, etc...). Which ones are required? I know what each does from the MSDN documentation, but I am looking for an example of this in use.

I am calling the RenderStream method and passing in empty strings (String.Empty) for each of the parameters and I am getting the following error:

"The selected report is not ready for viewing. The report is still being rendered or a report snapshot is not available. (rsReportNotReady)"

Any Ideas?

Thanks!

-Brian

Email Export?

Hello,

In the Crystal Report Viewer control, there is a way to export a report to the file format of choice (i.e. pdf or xls) and have it emailed.

This is probably a stupid question, but I have to ask it...

Is there a way to have an exported report in SSRS 2005 emailed without saving the report and then attaching it to an email?

I know about the scheduling services, but that will not work for me as my reports are created dynamically and displayed throught the ASP.NET 2.0 Report Viewer Control.

Thanks!!!

-Brian

Hi,

Have you tried Report Subscription using "Report Server E-mail" option? In BOL this is discussed under "E-Mail Delivery in Reporting Services". While configuring reports to be sent as an email you can include the report as a link or/and as an attachment.

HTH

Uday

|||

There is no supported email export. If you use the Viewer controls then your app could export the report and then send the email. Your app would have to take care of all smtp settings however.

-Daniel

|||

Thanks for the response Uday, but as noted in my original post, the report is created dynamically and not a published report. I cannot use the Scheduling/Subscription functionality...

-Brian

|||

Not built-into the ReportViewer control. Since you are sitting in code already, it is possible to wire this up really quickly using the classes in the System.Web.Mail namespace.

-Lukasz


This posting is provided "AS IS" with no warranties, and confers no rights.

|||

I am guessing I would need to use the ReportViewer's RenderStream method, but I cannot find good documentation on the parameters that are needed to call this method (i.e. streamId, mimeType, etc...). Which ones are required? I know what each does from the MSDN documentation, but I am looking for an example of this in use.

I am calling the RenderStream method and passing in empty strings (String.Empty) for each of the parameters and I am getting the following error:

"The selected report is not ready for viewing. The report is still being rendered or a report snapshot is not available. (rsReportNotReady)"

Any Ideas?

Thanks!

-Brian

Wednesday, February 15, 2012

Editing Underlying boolean data without making cells Editable

I'm having a real hard time coming up with a solution to this problem. I created a custom gridview control from Dino Esposito's "Extending Gridview" article which autogenerates a checkbox column that allows for multiple record selection. Once a user checks a box, the entire row gets selected. I added a dropdown list on the top of the page that has only two options, "Yes" or "No". What I'm trying to do is update a boolean column called "contract" (I'm using the Pubs sample database) for all selected rows (via checkboxes checked) depending on whether the user selects "Yes" or "No" from the drop down menu.

For example,

1) the user selects "No" in the dropdown

2) The user checks all rows in the checkbox column for which he wants the all the values"contract" field set to "No"

3) The user then clicks on a button called "Submit" and all selected records get updated to "No" under the "contracts" column.

The idea is to allow the user to change the boolean values from a field for multiple records. Hence, making individual cells editable is pointless. Anybody have an idea how to go about this?

Yes, do you have code you can post? Post it and I'll help.

|||

Ok I included the aspx and the aspx.cs code. I'm pretty new with asp.net so the code might not be all that great. Pay no heed to the MenuItems. The Post Back Button is what is supposed to trigger the updates after the selections are made. I appreciate your help.

<%@. Page Language="C#" AutoEventWireup="true" CodeFile="TestSSLServer.aspx.cs" Inherits="TestSSLServer" %><%@. Register Namespace="MsdnMag.CuttingEdge.Controls" TagPrefix="x" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:Menu ID="Menu1" runat="server" BackColor="#E0E0E0" DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="8pt" ForeColor="#284E98" Orientation="Horizontal" StaticSubMenuIndent="10px" OnMenuItemClick="Menu1_MenuItemClick"> <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" /> <DynamicHoverStyle BackColor="#284E98" ForeColor="White" /> <DynamicMenuStyle BackColor="#B5C7DE" /> <StaticSelectedStyle BackColor="#507CD1" /> <DynamicSelectedStyle BackColor="#507CD1" /> <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" /> <Items> <asp:MenuItem Text="Personal notes" Value="Notes"></asp:MenuItem> <asp:MenuItem Text="Orders" Value="Orders"></asp:MenuItem> </Items> <StaticHoverStyle BackColor="#284E98" ForeColor="White" /> </asp:Menu> <hr /> <asp:DropDownList ID="DropDownList1" runat="server" Width="133px"> <asp:ListItem Value="True">Yes</asp:ListItem> <asp:ListItem Value="False">No</asp:ListItem> </asp:DropDownList><br /> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:PUBSConnectionString%>" SelectCommand="SELECT [au_id], [au_lname], [au_fname], [phone], [address], [city], [state], [zip], [contract] FROM [authors]" /> <x:GridView runat="server" ID="GridView1" AutoGenerateCheckBoxColumn="True" DataSourceID="SqlDataSource1" AllowPaging="True" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" onrowupdating="GridView1_RowUpdating" Font-Names="Verdana" Font-Size="8pt" GridLines="Horizontal" AutoGenerateColumns="False" DataKeyNames="au_id"> <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" /> <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" /> <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" /> <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" /> <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" /> <AlternatingRowStyle BackColor="#F7F7F7" /> <Columns> <asp:BoundField DataField="au_id" HeaderText="au_id" ReadOnly="True" SortExpression="au_id" /> <asp:BoundField DataField="au_lname" HeaderText="au_lname" SortExpression="au_lname" /> <asp:BoundField DataField="au_fname" HeaderText="au_fname" SortExpression="au_fname" /> <asp:BoundField DataField="phone" HeaderText="phone" SortExpression="phone" /> <asp:BoundField DataField="address" HeaderText="address" SortExpression="address" /> <asp:BoundField DataField="city" HeaderText="city" SortExpression="city" /> <asp:BoundField DataField="state" HeaderText="state" SortExpression="state" /> <asp:BoundField DataField="zip" HeaderText="zip" SortExpression="zip" /> <asp:TemplateField HeaderText="contract" SortExpression="contract"> <itemtemplate> <asp:Label ID="Label1" runat="server" Text='<%# changeTrueFalseToYesNo(Eval("contract"))%>'></asp:Label> </itemtemplate> </asp:TemplateField> </Columns> </x:GridView> <asp:Button runat="server" ID="Button1" Text="Just post back" OnClick="Button1_Click" /> <hr /> <asp:Label ID="Results" runat="server" Text=""></asp:Label> </div> </form></body></html>

using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Data.SqlClient;public partialclass TestSSLServer : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e) { }// end Page_Load // The following method displays the string depending on whether the user // clicked on Notes or Orders. There is commented just adds the 0-based // index of the row the the txt string. This is just to check if the indexes // are correct when needed.protected void Menu1_MenuItemClick(object sender, MenuEventArgs e) {string txt ="";if (e.Item.Value =="Notes") txt ="Show personal notes for the following indices:<br>";else txt ="Show orders for the following indices:<br>";foreach (int indexin GridView1.GetSelectedIndices()) {string key = (string)GridView1.DataKeys[index].Value; txt += key +", ";// txt += index + ", "; } Results.Text = txt; }// The following method displays the record when the user // enters the submit button.protected void Button1_Click(object sender, EventArgs e) {// Get the GridViewRow object that represents the row being edited // from the Rows collection of the GridView control.foreach (int indexin GridView1.GetSelectedIndices()) { GridViewRow row = GridView1.Rows[index]; Label contractLabel = (Label)row.FindControl("contract");if (contractLabel.Text.Equals("Yes")) { e.NewValues["contract"] ="No"; }// end else ifelse if (contractLabel.Text.Equals("No")) { e.NewValues["contract"] ="Yes"; }// end else if }// end foreach }// end Button1_Clickprotected string changeTrueFalseToYesNo(object o) {string myString;if (Convert.ToBoolean(o) ==true) { myString ="Yes"; }// end ifelse { myString ="No"; }// end elsereturn myString; }// end changeTrueFalseToYesNo}// end of class

"MsdnMag.CuttingEdge.Controls" TagPrefix="x" %>

|||

I edited the code so that it is more readable. It's easier to see what I'm trying to do. Omit the Gridview1_updating in the markup. Sorry, about the messy code.