Showing posts with label textbox. Show all posts
Showing posts with label textbox. Show all posts

Saturday, February 25, 2012

Change Textbox value with diferent print copy

I want to print a report (localreport) 4 times, and i have a textbox that need to have different value for specific copy.

Ex.:

Copy 1 - Original

Copy 2 - Duplicate

...

Can i dynamically do this in the report?

Thanks

If you can place the changing text at the top of each copy, you could have one report without this heading that was the basic report. Then you could have a second report with 4 subreports, each pointing to the main report. At the top of each subreport you would place the "copy 1" etc. At the bottom of each subreport you would force a page break.

There may be a better way, such as driven from your data and using a single report, but without knowing details I think that would work.

Friday, February 24, 2012

Change SqlCommand Based On Combo Box Selection

I have a textbox, combo box, and a button on a form. I would like to perform a different query depending on the combo box selection. I thought I could do something such as:

if (cboSearch.Text =="Selection1") { scCmd ="SELECT * FROM tblTable WHERE txtSearch = @.Selection1"; }else if (cboSearch.Text =="Selection2") { scCmd ="SELECT * FROM tblTable WHERE txtSearch = @.Selection2"; }else { scCmd ="SELECT * FROM tblTable WHERE txtSearch = @.Selection3"; }
However, this obviously does not operate as I would need it to. What is the proper method for conditional SqlCommand statements like this?

You need to pass the value in as a Control Parameter.

http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.controlparameter.aspx