|
|
Infact, millions of thanks.
I appreciate your support. Thanks
|
|
|
|
|
|
It would be helpful to show the actual code you are using to assign the urls. What does the database results look like?
Assuming you are using HyperLink controls,
link.NavigationUrl = "Search/Cricket.aspx";
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|
Useless crap!!! Learn how to format the code before posting again.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi
In my gridview, I want to count the number of times each value (based of course on a field in my gridview) occurs. For example, if I have a field called Dept, in my result there is the following:
Dept A
Dept A
Dept A
Dept B
Dept B
Dept C
What I am trying to do is to show that for each Dept A, the count is 3, and for Dept B, the count is 2 and for Dept C the count is 1. When I have my count, I want to save them into my hidden field, which I am going to use else where in my code.
I know I need to do this in my rowdatabound event, and I have had ago, but the results I am getting back are not correct.
How do I solve this problem?
|
|
|
|
|
Could you post the code which you are using, so some can have a look?
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
Table tbl = e.Row.Parent as Table;
TableCell cell = new TableCell();
CheckBox chk = new CheckBox();
Label lbl2 = new Label();
HiddenField rowValue = new HiddenField();
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Visible = false;
}
else
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Label lbl = (Label)e.Row.FindControl("lblValue");
string str1 = ((Label)(lbl)).Text;
string prevStr= (string)Session["previousStr"];
if (prevStr== str1)
{
counter += 1;
}
else
{
prevStr= sr1 ;
Session["previousStr"] = prevStr;
counter = 1;
if (tbl != null)
{
GridViewRow row = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal);
rowValue.ID = "hdnNumRows";
rowValue.Value = counter;
lbl2.Text = Convert.ToString(counter);
cell.ColumnSpan = this.GridView1.Columns.Count;
cell.Width = Unit.Percentage(100);
cell.BackColor = System.Drawing.Color.Aqua;
HtmlGenericControl span = new HtmlGenericControl("span");
span.InnerHtml = prevStr;
cell.Controls.Add(span);
cell.Controls.Add(chk);
cell.Controls.Add(lbl2);
cell.Controls.Add(rowValue);
row.Cells.Add(cell);
tbl.Rows.AddAt(tbl.Rows.Count - 1, row);
}
}
}
}
}
As you can see, I have a counter in both parts of my if statement. This is so that if the "if" part is true the counter goes up by one, else it is still one. When run this with JavaScript to show the results, it is fine, I am seeing 3, 2, 1, but when I try show this in a label, all I am seeing 1,1,1. Why?
|
|
|
|
|
Instead of doing this on webserver, why dont you do this in the SQL itself?
Add a new column, lets say DeptCount which would give you the count.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
The reason being is that I only want to show the count in my inserted row, the value of which I am going to use in my checkbox control to then hide or show the rows which the user checks the checkbox
|
|
|
|
|
hi friends
In my button click,i opened two browser window seperately,now i want to open the two tab in same browser window instead of open two window seperately(IE only)...
can any one help?
Known Is Drop.Unknown Is Ocean
|
|
|
|
|
No web technology knows about the Tabs. All it knows is the window.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
You can do a custom tab yourself, which can switch the pages in a window
April
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 8:50am.
|
|
|
|
|
used iframe in my webpage want to get url of the ifram , refresh the iframe, full screen the iframe
modified on Saturday, January 23, 2010 1:39 AM
|
|
|
|
|
Hi
I have list box where i written code on selectedindexchanged event in code behind. I also want to run java script on the same event or click event so that my code behind code also run with respected to java script.
I have written javascript for color changed of listbox selected item and on selected index changed I have written some database functionality.
Is it possible?? Or any other solution for that.
Thanks
|
|
|
|
|
Yes it is possible but remember that the SelectedIndexChanged event will cause a postback and the page will be re-rendered, wriping away any thing that was done by the JavaScript. Depending on what the action is or your expected results you could use an Ajax call rather than the traditional postback
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi Everybody,
I have aspx page in which there is one link. When user clicks on the link it should open a (Silver Light or normal) model dialogue box or popup with few checkbox options. As soon as user selects them and clicks the button. The information should be saved.
Can I use WPF or Silver Light model dialogue box in aspx page. Please help me in this regard. Atleast by some links. In this mean time I will try from my side with google uncle (nice uncle for any help) .
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
Seems you have a lot to learn and maybe you should do that before trying to continue. WPF and Silverlight are not interchangeable. WPF, which stands for WINDOWS Presentation Foundation, can't be used in a web application. Neither can you just create a Silverlight dialog and use it is a webpage.
There are several articles and resources available that discuss modal dialogs in a web application, they're not that difficult to find.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,
I want to keep an HTML table with pagiing inside a ajax tab control for that I have written following code
This is ASPX code
<ajax:TabContainer ID="tabHomeownTips" runat="server"
ActiveTabIndex="0" Width="565px" Height="600px" Font-Underline="False"
Enabled="true" EnableTheming="True" ScrollBars="Auto" EnableViewState="False" >
<ajax:TabPanel ID="TabTip1" HeaderText="Tip1" runat="server" OnClientClick="function(){LoadTableTab('results','pageNavPosition');}">
<ContentTemplate>
<table id="results" >
<tr>
<th>Sr. No.</th>
<th>Description</th>
</tr>
<tr>
<td>1</td>
<td>Description of Tab1 Item 1</td>
</tr>
<tr>
<td>2</td>
<td>Description of Tab1 Item 2</td>
</tr>
<tr>
<td>3</td>
<td>Description of Tab1 Item 3</td>
</tr>
<tr>
<td>4</td>
<td>Description of Tab1 Item 4</td>
</tr>
<tr>
<td>5</td>
<td>Description of Tab1 Item 5</td>
</tr>
<tr>
<td>6</td>
<td>Description of Tab1 Item 6</td>
</tr>
</table>
<div id="pageNavPosition"></div>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel ID="TabTip2" HeaderText="Tip2" runat="server" OnClientClick="function(){LoadTableTab('Table1','Div1');}">
<ContentTemplate>
<table id="Table1">
<tr>
<th>Sr. No.</th>
<th>Description</th>
</tr>
<tr>
<td>1</td>
<td>Description of Tab1 Item 1</td>
</tr>
<tr>
<td>2</td>
<td>Description of Tab1 Item 2</td>
</tr>
<tr>
<td>3</td>
<td>Description of Tab1 Item 3</td>
</tr>
<tr>
<td>4</td>
<td>Description of Tab1 Item 4</td>
</tr>
<tr>
<td>5</td>
<td>Description of Tab1 Item 5</td>
</tr>
<tr>
<td>6</td>
<td>Description of Tab1 Item 6</td>
</tr>
</table>
<div id="Div1"></div>
</ContentTemplate>
</ajax:TabPanel>
</ajax:TabContainer>
</pre>
This is Javascript code
function LoadTableTab(tblid,divid){
var pager = new Pager(tblid, 2);
pager.init();
pager.showPageNav('pager', divid);
pager.showPage(1);
}
function Pager(tableName, itemsPerPage) {
this.tableName = tableName;
this.itemsPerPage = itemsPerPage;
this.currentPage = 1;
this.pages = 0;
this.inited = false;
this.showRecords = function(from, to) {
var rows = document.getElementById(tableName).rows;
// i starts from 1 to skip table header row
for (var i = 1; i < rows.length; i++) {
if (i < from || i > to)
rows[i].style.display = 'none';
else
rows[i].style.display = '';
}
}
this.showPage = function(pageNumber) {
if (! this.inited) {
alert("not inited");
return;
}
var oldPageAnchor = document.getElementById('pg'+this.currentPage);
oldPageAnchor.className = 'pg-normal';
this.currentPage = pageNumber;
var newPageAnchor = document.getElementById('pg'+this.currentPage);
newPageAnchor.className = 'pg-selected';
var from = (pageNumber - 1) * itemsPerPage + 1;
var to = from + itemsPerPage - 1;
this.showRecords(from, to);
}
this.prev = function() {
if (this.currentPage > 1)
this.showPage(this.currentPage - 1);
}
this.next = function() {
if (this.currentPage < this.pages) {
this.showPage(this.currentPage + 1);
}
}
this.init = function() {
var rows = document.getElementById(tableName).rows;
var records = (rows.length - 1);
this.pages = Math.ceil(records / itemsPerPage);
this.inited = true;
}
this.showPageNav = function(pagerName, positionId) {
if (! this.inited) {
alert("not inited");
return;
}
var element = document.getElementById(positionId);
var pagerHtml = ' ';
for (var page = 1; page <= this.pages; page++)
{
if(page >1)
{
pagerHtml += ' | ';
}
pagerHtml += '<span id="pg' + page + '" class="pg-normal" onclick="' + pagerName + '.showPage(' + page + ');">' + page + '</span>';
pagerHtml += '';
}
element.innerHTML = pagerHtml;
}
}
I have tried this code in normal page it works fine but when I am using same code then Its giving me the Table in Paging section but whenever I am click on Page number I am getting error as 'pager' is undefined. What am I missing and How can I fix this bug to make it working in ajax tab control
Thanks
Rock Star
|
|
|
|
|
Hello,
I have created one crystal report. On the default.aspx page, i have added crystalreportsource and crystalreportviewer and set its report sources. Crystalreport.Printmode=Activex.
I want the output should come :
(A) On screen
(B) Directly to the client printer machine
simantenously. On client machines i have set Generic printer as default.
How do i get the output on page and directly on printer simantenously on clicking of a button.
Regards
Girish
|
|
|
|
|
Hi, Please change the System & Printer names based on yours.
code is below
ReportDocument rptPrint = new ReportDocument();
rptPrint.Load(Server.MapPath("Reports").ToString() + "\\rptSales.rpt");
DataSet dsData = (DataSet)Session["EmpData"];
rptPrint.SetDataSource(dsData);
CrystalReportViewer1.ReportSource = rptPrint;
CrystalReportViewer1.DataBind();
string strSystemName = "\\\\RAJA\\";
string strPrinterName = "SAMSUNG";
rptPrint.PrintOptions.PrinterName = strSystemName + strPrinterName;
rptPrint.PrintToPrinter(1, false, 0, 0);
rptPrint.Close();
rptPrint.Dispose(); Please let me know your feedback because i was posted a wrong link as answer for a question today in Quick Answers section.
Regards,
thatraja
|
|
|
|
|
Thanks for reply and your concern for answer. I just want to know how it will print on client machine using above code. I mean what should i write in :
string strSystemName = "\\\\RAJA\\";
string strPrinterName = "SAMSUNG";
Let me once again clear my question.
I need to send the crystal report output directly on different cleint machines, on clicking of a button. In the above example how do i get the strSystemName and strPrinterName for unknown client machines.
Regards
Girish Sharma
|
|
|
|
|
I'm sorry i forgot that,
System.Net.IPHostEntry host;
host = System.Net.Dns.GetHostEntry(Context.Request.ServerVariables["REMOTE_HOST"]);
string strSystemName = host.HostName; please let me know your feedback again & assume you have the solution. I'm upset from evening for a wrong answer to one question. So please try to make me happy.
Regards,
thatraja
|
|
|
|
|
Thanks again for your reply. I am using below code with one crystalreportviewer and one button control on web page.
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ocn As New System.Data.OracleClient.OracleConnection
Dim oda As New System.Data.OracleClient.OracleDataAdapter("select empno,ename from emp", ocn)
Dim ods As New System.Data.DataSet()
ocn.ConnectionString = "Data Source=orcl;User ID=scott;Password=pw;Unicode=True"
oda.Fill(ods)
Dim rptprint As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
rptprint.Load(Server.MapPath("Reports").ToString() + "\\CrystalReport.rpt")
rptprint.SetDataSource(ods)
CrystalReportViewer1.ReportSource = rptprint
CrystalReportViewer1.DataBind()
''rptprint.PrintOptions.PrinterName = DefaultPrinterName()
''rptprint.PrintToPrinter(1, False, 0, 0)
TextBox1.Text = DefaultPrinterName()
rptprint.Close()
rptprint.Dispose()
ocn.Close()
ocn.Dispose()
ods.Dispose()
oda.Dispose()
End Sub
Public Shared Function DefaultPrinterName() As String
Dim oPS As New System.Drawing.Printing.PrinterSettings
Try
DefaultPrinterName = oPS.PrinterName
Catch ex As System.Exception
DefaultPrinterName = ""
Finally
oPS = Nothing
End Try
End Function
But i am getting error "Object reference not set to an instance of an object." at line CrystalReportViewer1.ReportSource = rptprint. And one more thing it is not returning me the correct default printer name as i have shown in textbox1 control.
Kindly help me to get the direct print using crystal report on clicking of a button on client's line matrix / dot matrix printer. I have set "Generic / Text Only" as their default printers.
Regards
Girish Sharma
|
|
|
|