|
write code in the GridView1_RowCreated event.
If e.Row.RowType = DataControlRowType.Header Then
'write code for the grid header only
else
'write code for rest of the rows
you can customize every column from here.
e.Row.Cells(0).CssClass = "style1"
End If
from style you can change anything forecolor, backcolor, font, font size ... anything...
The miracle is this--the more we share, the more we have.
|
|
|
|
|
Hi Friends,
I have a list box in which 12 items are displayed at a time.If more than 12 items are present and if i click on the 1st item and then use arrow keys to navigate further down the scroll is not working but if i use mouse to scroll down its working.
Please suggest a solution for this problem.
Thanks in advance.
Santosh.
|
|
|
|
|
Hi All,
I've got a really simple Mvc app that I'm having trouble communicating with via Fiddler.
My Controller looks like this:
[ActionName("AddEmail")]
[AcceptVerbs(HttpVerbs.Post)]
public EmptyResult AddEmail(FormCollection collection)
{
Console.WriteLine("I called the AddEmail ActionMethod!");
return new EmptyResult();
}
And I have this mapped in Global.asax like this:
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default",
"{controller}",
new { controller = "Test", action = "AddEmail", id = "" }
);
}
protected void Application_Start()
{
RegisterRoutes(RouteTable.Routes);
}
}
Using fiddler to create a POST with a simple html form in results in an HTTP 405 error saying that the resource is not allowed.
Not sure what to check in terms of configuration in order to get this to accept POST requests. Any ideas would be much appreciated. I'm using IIS 5.1.
Thanks,
|
|
|
|
|
Hello,
In asp.net, at present I get the user details inside the aspx.cs file as follows:
string strUserName = User.Identity.Name;
Do you know how to get this information within a class which I have under the app_code folder? it seems the same code does not work in there.
Thanks
|
|
|
|
|
It's in a thing I like to call documentation[^]. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hello, i searched a bit but couldn`t find any info about this !!
Is there any way to detect the active Addons on the browser that is being used?
I mean the user comes to your aspx page, and you take a course of action if a particular addon is installed or not.
|
|
|
|
|
There are plenty of articles out there if you get specific about what plugin you are looking for. I have seen articles for detecting flash, adobe reader, silverlight, and java.
|
|
|
|
|
Hello..
I am not talking about plugins..Let me give you an example
Firefox has an addon called Downloadhelper, how could i detect that this addon is active while the user is surfing my wep page and take a course of action according to it...
|
|
|
|
|
Firefox changed what they call them but they are still plugins.
Even Mozilla themselves can't decide what they call them. Note the Mozilla Addons page[^] starts with "Plugins help your browser perform specific functions..."
|
|
|
|
|
Hmm ok i`ll look into it, thanx
|
|
|
|
|
Hello,
how to print Landscape report using ASP.Net/
How can i print landscape report using asp.net ?
Regard
ali.
|
|
|
|
|
it depends how you creating report, is it doc, excel, pdf, directly, or you are using crystal report.
it you are using any particular class for creating report, so approx every class having its page setting property.
If your problem is still not solve. Send some more details.
The miracle is this--the more we share, the more we have.
|
|
|
|
|
I have an ASP.NET/C# application that saves visitors feedback through a textBox. How do I make sure that the feedback is displayed in the format it was typed. E.g.
Dear Admin,
I loved the look and feel of your site...
It's a great job!!!
Aweda Akeem
How do I save and display in the same format (including the witespaces, linefeeds, etc?
Thanks you all!
|
|
|
|
|
An easy way would be to use the AjaxControlToolkit HtmlEditor[^]. Save the resultant data to the database and view back in the editor or a label as required. You'll need to encode the data (see here to get started: HttpServerUtility..::.HtmlEncode[^]. You can display the data by reversing the process.Tychotics: take us back to the moon
"Life, for ever dying to be born afresh, for ever young and eager, will presently stand upon this earth as upon a footstool, and stretch out its realm amidst the stars."
H. G. Wells
|
|
|
|
|
Thank you for your prompt response. I appreciate that! Tunsten
|
|
|
|
|
Hi ,
Please help me to convert a dataset to Excelsheet ?
With Regards.
|
|
|
|
|
You can refer to the following code:
public int ExportToExcel(DataTable schemaTable, string tableName, string filePath, DataTable source)
{
string connString = "Provider = Microsoft.Jet.OLEDB.4.0 ;Persist Security Info=False; Data Source = " + filePath + ";Extended Properties=Excel 8.0;";//'HDR=Yes;IMEX=1";
if(System.IO.File.Exists(filePath))
{
System.IO.File.Delete(filePath);
}
string create = "Create Table [";
create += tableName;
create += "] (";
string sourceColumn = "(";
foreach(DataRow dr in schemaTable.Rows)
{
string columnName = dr["ColumnName"].ToString();
//create string
create += "[";
create += columnName;
create += "]";
sourceColumn += "[" + columnName + "],";
string type = dr["DataType"].ToString();
switch(type)
{
case "System.Int32":
case "System.Int16":
case "System.Int64":
case "System.UInt32":
case "System.UInt16":
case "System.UInt64":
create += " INTEGER NULL,";
break;
case "System.Decimal":
case "System.Double":
case "System.Single":
create += " numeric NULL,";
break;
case "System.DateTime":
create += " datetime NULL,";
break;
case "System.Boolean":
create += " BINARY NULL,";
break;
default:
create += " varchar(";
create += dr["ColumnSize"].ToString();
create += ") NULL,";
break;
}
}
create = create.Substring(0, create.Length - 1);
create += ")";
using(OleDbConnection conn = new OleDbConnection(connString))
{
conn.Open();
using(OleDbTransaction trans = conn.BeginTransaction())
{
try
{
OleDbHelper.ExecuteNonQuery(trans, create);//create table
string insertHead = "Insert Into [" + tableName + "]" + sourceColumn.Substring(0, sourceColumn.Length - 1) + ") Values";
int result = 0;
foreach(DataRow dr in source.Rows)
{
string valueStr = "(";
for(int j = 0; j < source.Columns.Count; j++)
{
if(source.Columns[j].DataType == typeof(System.String))
{
valueStr += "'" + dr[j].ToString().Replace("'", "’") + "',";
}
else if(source.Columns[j].DataType == typeof(System.DateTime))
{
string date = dr[j].ToString();
if(date == string.Empty)
{
valueStr += "null,";
}
else
{
valueStr += "'" + date + "',";
}
}
else
{
valueStr += dr[j].ToString() + ",";
}
}
string insert = insertHead + valueStr.Substring(0, valueStr.Length - 1) + ")";
result += OleDbHelper.ExecuteNonQuery(trans, insert);
}
trans.Commit();
return result;
}
catch
{
trans.Rollback();
throw;
}
}
}
}
April
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 8:43am.
|
|
|
|
|
Thank You.
|
|
|
|
|
hai friends
Can anyone pls help in finding why checkbox change event is not firing which is put inside a gridview.
Whenever I checks the checkbox the page is posting back but the event is not firing or is not called, why so?
Autopostback and runat= server etc are set..
Thanks in advance
Santhosh
Santhosh
|
|
|
|
|
Santhosh Sebastian Mattathil wrote: finding why checkbox change event is not firing
Can you post the code so that any one can find it...
|
|
|
|
|
I am using Visual Studio Web Developer 2008, CSS 2.1
Browser Firefox 3.5.8, IE 6.0.2900
I am trying to add this menu described here
[], but it is causing all the master page components to change positions.
I created a master page following tutorials elsewhere and the problem mainly comes with the Menu bar, I created a custom menu bar to suit my needs, rather than using the inbuilt menu, but i am guessing because of the menu the webpage components are out of place in
1)Firefox: there is a Nav div on the left hand side of the page
Structure of intended webpage
------------------------------
Logo Title
Dotted Line
Menu
Dotted Line
Nav Main Content page
(25%) (margin-left:30%;)
footer
This is how i am trying to arrange the page but in firefox the Nav falls to the right, CSS setting justify:left dosent help.
2)In Internet Explorer
The menu appears vertical rather than horizontal
Please find the code to my Master Page below, however note that i am NOT trying to use the asp:menu item for a menu, and using a customized menu. Because of which my master page is all over the browser.
I would really appreciate if anyone can provide any sort of suggestions.
Please find Master Page below.
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!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>
<link href="StyleSheet.css" type="text/css" rel="Stylesheet" />
<script language="javascript" src="menu.js" type="text/javascript" ></script>
</head>
<body>
<div id="outer">
<div id="header">
<div id="lhead">
<img alt="logo1" src="Images/team1.jpg" style="height: 45px; width: 44px"/>
<a href="Default.aspx" style="color:Black; text-decoration:none" ><i><b>TEAM</b></i></a>
</div>
<div id="rhead">
<img alt="logo2" src="Images/team6.jpg" style="height: 46px; width: 50px" />
<img alt="logo3" src="Images/team3.jpg" />
<img alt="logo4" src="Images/team5.jpg" style="height: 44px; width: 54px" />
<img alt="logo5" src="Images/team4.jpg" style="height: 43px; width: 56px" />
</div>
<b id="team definition" style="color:Black; text-decoration:none; font-size:x-small;
font-weight:lighter; display:block; text-align:left;">REDEFINING EXCELLENCE</b>
<ul id="menu1">
<li><a href="#">home</a></li>
<li><a href="#"
onmouseover="mopen('m1')"
onmouseout="mclosetime()">products & services</a>
<div id="m1"
onmouseover="mcancelclosetime()"
onmouseout="mclosetime()">
<a href="#">engineering services</a>
<a href="#">engineering products</a>
<a href="#">it services</a>
</div>
</li>
<li>
<a href="#"
onmouseover="mopen('m2')"
onmouseout="mclosetime()">about us</a>
<div id="m2"
onmouseover="mcancelclosetime()"
onmouseout="mclosetime()">
<a href="#">company history</a>
<a href="#">achievements & awards</a>
<a href="#">company policies</a>
<a href="#">future growth & vision</a>
</div>
</li>
<li>
<a href="#"
onmouseover="mopen('m3')"
onmouseout="mclosetime()">careers</a>
<div id="m3"
onmouseover="mcancelclosetime()"
onmouseout="mclosetime()">
<a href="#">career path</a>
<a href="#">type of jobs</a>
<a href="#">current openings</a>
</div>
</li>
<li>
<a href="#"
onmouseover="mopen('m4')"
onmouseout="mlosetime()">help & support</a>
<div id='m4'
onmouseover="mcancelclosetime()"
onmouseout="mclosetime()">
<a href="#">technical support</a>
<a href="#">feedback form</a>
</div>
</li>
<li>
<a href="#">contact us</a>
</li>
<li>
<a href="#">site map</a>
</li>
</ul>
</div>
<div id="body1">
<div id="nav">
<h4>Navigation</h4>
<ul>
<li>text1</li>
<li>text2;/li>
<li>text3;/li>
</ul>
</div>
<div id="main">
<p>Main Content -- text
<div id="footer">
<p>Footer text -- text </p>
</div>
</div>
</div>
</body>
</html>
Please reply, thanks.
|
|
|
|
|
When i assign the html table to the hiddenfield value using javascript i am getting the error like this:
"A potentially dangerous Request.Form value was detected from the client (ctl00$ContentPlaceHolder1$hd2="<TBODY>
<TR>
<TD c...")."
I used the javascript function like this:
var element = document.getElementById("aspnetForm");
var store1 = document.getElementById("tb1");
document.getElementById("ctl00_ContentPlaceHolder1_hd2").value = store1.innerHTML.toString();
Help me how to solve this
|
|
|
|
|
Having angular braces "<" with in a text box, hidden field, text area, etc., triggers this error during server post. ASP.NET engine thinks that malicious code has been injected into the request stream and stops processing the request and raises this error, when it encounters such a situation.
To over come this, either replace the angular braces with their HTML code "<" - & l t ; ">" - & g t ; [with out the spaces] or else set ValidateRequest="false" on the page directive of the page.
This web page has examples for both solutions Allowing HTML Formatted User Input in ASP.NET [^]
NOTE: The later would make your page susceptible to injection attacks.
|
|
|
|
|
I made the validationRequest property to false
now the problem is solved but the table is displaying along with the td and tr tags in excel how can i solve this
|
|
|
|
|
What exactly are you trying to do?? Your original post has nothing about writing to an excel!?
|
|
|
|