Set the NavigateUrl property of TreeNode object to the URL like 'www.mysite.com/default.aspx?onenode' and Target property to the name of the IFrame.
Hope this will help you.
Set the NavigateUrl property of TreeNode object to the URL like 'www.mysite.com/default.aspx?onenode' and Target property to the name of the IFrame.
Hope this will help you.
Yes. you have to use a SELECT statement with WHERE condtion before inserting the user information.
See the sample code below
'Change your database name and path
Dim strConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\TestDB.MDB"
Dim con As OleDbConnection = New OleDbConnection(strConnection)
con.Open()
'construct your where condtion
Dim strQuery1 As String = "SELECT EMPNO FROM FDXUSERS WHERE EmpNo = " + employeeNo
Dim aCommand1 As OleDbCommand = New OleDbCommand(strQuery1, con)
Dim objExist As Object = aCommand1.ExecuteScalar()
'construct your INSERT statement here
Dim strQuery2 As String = "INSERT INTO FDXUSERS VALUES(4, 'John', 30000, 20)"
Dim aCommand2 As OleDbCommand = New OleDbCommand(strQuery2, con)
If objExist Is Nothing Then
aCommand2.ExecuteNonQuery()
End If
con.Close()
The statement 'SpecifyRolesStep.FindControl("RoleList")' may not return a control.
Check that by putting a break point.
You have put the break statement after closing the 'if' block and before the closing braces of 'for' loop.
So the' for' loop will be executed only once and the counter lCount++ will never be executed. Therefore it displays 'Unreachable code detected' error.
You should put the break statement inside the 'if' block.
I have changed your code.
protected void btnSellProduct_Click(object sender, EventArgs e)
{
string sPath = Server.MapPath("~/");
string sFileName = sPath + "item.txt";
string[] sArr;
string[] sArr2;
int lCount;
int lCurrentStock;
int lSellingStock;
if (File.Exists(sFileName.Trim()))
{
sArr = System.IO.File.ReadAllLines(sFileName);
for (lCount = 0; lCount <= sArr.Length - 1; lCount++)
{
sArr2 = sArr[lCount].Split(new string[] { "^^^^" }, StringSplitOptions.None);
if (sArr2[0].Trim() == txtSellProdID.Text.Trim())
{
lCurrentStock = Convert.ToInt32(sArr2[3]);
lSellingStock = Convert.ToInt32(txtQtyToSold.Text);
if (lSellingStock > lCurrentStock)
lblStatus.Text = "Could not Sell this Product.Out of Stock";
else
{
WriteToTransactionFile();
DecrementFromItemFile();
lblStatus.Text = "Transaction Processed Successfully";
}
break;
}
}
}
}
'return subconfirm()' will not work in anchor object.
Try this
function subconfirm() {
if (confirm("Are you sure to submit these details from database?")) {
window.location = 'addlink.php?id=<?=$row[ID]?>';
}
}
<a href="#" onclick=" return subconfirm()">SUBMIT</a>
Are you opening any popup in your javascript function which is called in mouse over event.
Also check the path used in your img control is correct.
Check this link: http://support.microsoft.com/default.aspx?scid=kb;en-us;816362
http://stackoverflow.com/questions/226102/stack-overflow-in-line-0-on-internet-explorer
Pass the information as querystring to your target web page. In page load, get values from the querystring and store it in your control.
The index of the first column starts with 0 and last index is 'Total columns' -1. That is if your GridView has 7 columns then the last index will be 6.
Also you can hide a column in a GridView by the following method
GridView1.Columns[6].Visible = false;
You have ro check the value of the variable @sql and execute the SELECT query stored in it.
Pass necessary parameters to your stored procedure and print the @SQL variable from your query.
Put a print statement before EXEC as below
PRINT @SQL
This will print the content of @SQL in the output window in SQL Management Studio.
Copy that query, past it in a new Query Window and execute it.
Check whether it returns any result.
Try this
SELECT *
FROM Employee E1
WHERE (N-1) = (
SELECT COUNT(DISTINCT(E2.Salary))
FROM Employee E2
WHERE E2.Salary > E1.Salary)
To use Visual Web Developer 2008 Express for Silverlight 2 development
1. You need to install Microsoft Visual Web Developer 2008 Express with SP1.
2. Install Microsoft® Silverlight™ 2 Tools for Visual Studio 2008 SP1. This will add C# and VB.NET Project templates for Silverlight 2.
To use Visual Studio Team System 2008 for Silverlight 2 development
1. You need to install Microsoft Visual Studio 2008 Service Pack 1
2. Install Microsoft® Silverlight™ 2 Tools for Visual Studio 2008 SP1. This will add C# and VB.NET Project templates for Silverlight 2.
You can design local reports (.rdlc) report using VS 2008 and display it in a web page using report viewer control.
Check this link: http://www.codeproject.com/KB/webforms/ReportViewer.aspx
I think the code inside the for loop and if condition is not executed.
Set the value of the notEmpty to false by default.
var input, notEmpty = false;
Also call this function in the OnClientClick of the button as below
OnClientClick="return Check(form1)"
Refere this sample code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DemoPage7.aspx.cs" Inherits="DemoPage7" %>
<!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>Minimize IE</title>
<script language="javascript">
function validateTextBoxes() {
//store trimmed values of textboxes into variables
var txt1 = document.getElementById('TextBox1').value.replace(/^\s+|\s+$/g, '');
var txt2 = document.getElementById('TextBox2').value.replace(/^\s+|\s+$/g, '');
var txt3 = document.getElementById('TextBox3').value.replace(/^\s+|\s+$/g, '');
if ((txt1 == null || txt1 == "") &&
(txt2 == null || txt2 == "") &&
(txt3 == null || txt3 == "")) {
alert('Atlease one textbox should be entered');
return false;
}
else
return true;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table width="100%">
<tr>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<asp:Button ID="btnSubmit" OnClientClick="return validateTextBoxes()" runat="server"
Text="Submit" OnClick="btnSubmit_Click" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
Try this javascript function
<script>
show=1
function minimize(){
moveBy(2000,2000)
show=0
}
function reshow(){
if(show==0{
moveBy(-2000,-2000)
show=1
}
}
</script>
You need to put a onfocus=reshow() to the body tag. Also, call the minimize() function in onclick event of a button.
A complete example
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DemoPage6.aspx.cs" Inherits="DemoPage6" %>
<!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 runat="server">
<title>Minimize IE</title>
<script language="javascript">
show = 1
function minimize() {
moveBy(2000, 2000)
show = 0
}
function reshow() {
if (show == 0) {
moveBy(-2000, -2000)
show = 1
}
}
</script>
</head>
<body onfocus="reshow()">
<form id="form1" runat="server">
<div>
<input id="Button1" type="button" onclick="minimize()" value="button" />
</div>
</form>
</body>
</html>
Hi SID,
Mark this thread as solved.
Regards
Do you want to pass paramters to crystal report or SSRS?
You are storing date value as a string of characters in the backend database.
Check the date value stored in the database has time part.
If it has time part, then you need to format the calender value before inserting into database.
sqlinsert = "INSERT INTO FDXUSER(First_Name,Last_Name,Email,Station_ID,User_Name,Password,SQ_1,SA_1,SQ_2,SA_2,SQ_3,SA_3,Security_Level)Values(" & first_name.Text & "," & last_name.Text & "," & email_address.Text & ",'" & Stationident.SelectedValue & "'," & User_Name.Text & "," & password1.Text & "," & "*,*,*,*,*,*,3)"
You are only putting single quote around Stationident.SelectedValue.
Is that Station_ID the only text column in the FDXUSER table?
If irst_Name,Last_Name,Email etc.. are also text columns, then put single quoto for them.
Try the following logic.
DateTime m_StartDate, m_EndDate;
DateTime db_StartDate, db_EndDate;
//Write code m_StartDate and m_EndDate from the web page
/*
m_StartDate = Start Date from the web page
m_EndDate = End Date from the web page
*/
/*
* Write code to get Start Date and End Date from
* the database using a data reader
* fill it in the followin variables
db_StartDate = Start Date from db
db_EndDate = End Date from db
*/
bool isValidRange = false;
if (m_StartDate <= m_EndDate)
{
if ((m_StartDate >= db_StartDate) &&
(m_EndDate <= db_EndDate))
isValidRange = true;
}
if (isValidRange)
Response.Write("Valid date range");
else
Response.Write("Invalid date range");
Also you can pass the m_StartDate and m_EndDate values to a stored precedure where you can validate the date range and return a boolean value based on that validation.
if i need to retreave mor than one valu (lets say pasword and the first name ) is this code correct.
SqlCommand sqlcmd = new SqlCommand("Select Password,firstname from <Table name> Where UserName = '"+textBox1.Text+"' first name = '"+textBox2.Text+", con);
You are fetching password and first name based on user name. Therefore the WHERE condition need not to have first name.
It should look like SqlCommand sqlcmd = new SqlCommand("Select Password,firstname from <Table name> Where UserName = '"+textBox1.Text+"' , con);
Post your code segment where you are getting issue.
It will be helpful to give you a solution.
You have put a single quote before the file name(Data Source='~\FDXDB3.mdb) which is not closed properly.
It should be like below
SqlConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source='~\FDXDB3.mdb';User ID=Admin;Password=;"
It seems that you have mixed both classic asp and asp.net to achieve your requirement.
I have given some sample code for this. Hope this will help you.
HTML Source
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DemoPage5.aspx.cs" Inherits="DemoPage5" %>
<!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 runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
</div>
</form>
</body>
</html>
Code behind class source
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
public partial class DemoPage5 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
LoadControls();
}
private void LoadControls()
{
for (int i = 0; i < 10; i++)
{
Button btn = new Button();
btn.ID = "buttonX" + i.ToString();
btn.CommandArgument = "arg" + i;
btn.CommandName = "YourCommandName";
btn.Text = "Delete";
btn.Command += new CommandEventHandler(ButtonX_Command);
PlaceHolder1.Controls.Add(btn);
LiteralControl litCtrl = new LiteralControl("<br/>");
PlaceHolder1.Controls.Add(litCtrl);
}
}
protected void ButtonX_Command(object sender, CommandEventArgs e)
{
string cmdArgument = e.CommandArgument.ToString();
switch (cmdArgument)
{
case "arg0":
//your code
break;
case "arg1":
//your code
break;
case "arg2":
//your code
break;
}
}
}
Try either
window.location.reload(true);
or
window.opener.document.forms(0).submit();
before you close the popup window.
Post your code. It will help us to give you a correct solution.
Try this
if (!IsPostBack)
{
MenuItem menuHome = new MenuItem("Home");
MenuItem menuMusic = new MenuItem("Music");
menuMusic.NavigateUrl = "Music.aspx";
MenuItem menuClassical = new MenuItem("Classical");
menuClassical.NavigateUrl = "Classical.aspx";
menuMusic.ChildItems.Add(menuClassical);
MenuItem menuRock = new MenuItem("Rock");
menuRock.NavigateUrl = "Rock.aspx";
menuMusic.ChildItems.Add(menuRock);
menuHome.ChildItems.Add(menuMusic);
MenuItem menuMovies = new MenuItem("Movies");
menuMovies.NavigateUrl = "Movies.aspx";
MenuItem menuAction = new MenuItem("Action");
menuAction.NavigateUrl = "Action.aspx";
menuMovies.ChildItems.Add(menuAction);
MenuItem menuDrama = new MenuItem("Drama");
menuDrama.NavigateUrl = "Drama.aspx";
menuMovies.ChildItems.Add(menuDrama);
menuHome.ChildItems.Add(menuMovies);
Menu1.Items.Add(menuHome);
}
Check this:
XmlDocument xmldoc = new XmlDocument();
XmlNode root = xmldoc.CreateElement("My", "Field", "Test");
xmldoc.AppendChild(root);
XmlElement firstName = xmldoc.CreateElement("My", "Field1", "Test");
firstName.InnerText = "John";
root.AppendChild(firstName);
XmlElement lastName = xmldoc.CreateElement("My", "Field2", "Test");
lastName.InnerText = "Smith";
root.AppendChild(lastName);
XmlElement myField3 = xmldoc.CreateElement("My", "Field3", "Test");
myField3.InnerText = "Field3 Value";
root.AppendChild(myField3);
XmlElement myField4 = xmldoc.CreateElement("My", "Field4", "Test");
myField4.InnerText = "Field4 Value";
root.AppendChild(myField4);
xmldoc.Save(@"C:\simple.xml");
If you are able to get numbers from the file into data reader, then you can also convert the data reader into data table.
Refer this code
SqlConnection cn = new SqlConnection("Server=(local);database=Northwind;user id=sa;password=;");
string sql = "Select * from Employees";
SqlCommand cmd = new SqlCommand(sql, cn);
cn.Open();
SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
DataTable dt = new DataTable();
dt.Load(dr);
dr.Close();
Try this. buttonX.CommandName = attributeName;
Hope this will help you
XmlDocument xmldoc = new XmlDocument();
xmldoc.LoadXml("<?xml version='1.0' ?>" + "<MyFields>" + "</MyFields>");
XmlNode root = xmldoc.DocumentElement;
XmlElement firstName = xmldoc.CreateElement("MyField1");
firstName.InnerText = "John";
root.AppendChild(firstName);
XmlElement lastName = xmldoc.CreateElement("MyField2");
lastName.InnerText = "Smith";
root.AppendChild(lastName);
XmlElement myField3 = xmldoc.CreateElement("MyField3");
myField3.InnerText = "Field3 Value";
root.AppendChild(myField3);
XmlElement myField4 = xmldoc.CreateElement("MyField4");
myField4.InnerText = "Field4 Value";
root.AppendChild(myField4);
xmldoc.Save(@"C:\simple.xml");
You can use CommandName and CommandArgument for this requirement.
A Simple example
HTML source
<form id="form1" runat="server">
<h3>Button CommandName Example</h3>
Click on one of the command buttons.
<br /><br />
<asp:Button id="Button1"
Text="Sort Ascending"
CommandName="Sort"
CommandArgument="Ascending"
OnCommand="CommandBtn_Click"
runat="server"/>
<asp:Button id="Button2"
Text="Sort Descending"
CommandName="Sort"
CommandArgument="Descending"
OnCommand="CommandBtn_Click"
runat="server"/>
<br /><br />
<asp:Button id="Button3"
Text="Submit"
CommandName="Submit"
OnCommand="CommandBtn_Click"
runat="server"/>
<asp:Button id="Button4"
Text="Unknown Command Name"
CommandName="UnknownName"
CommandArgument="UnknownArgument"
OnCommand="CommandBtn_Click"
runat="server"/>
<asp:Button id="Button5"
Text="Submit Unknown Command Argument"
CommandName="Submit"
CommandArgument="UnknownArgument"
OnCommand="CommandBtn_Click"
runat="server"/>
<br /><br />
<asp:Label id="Message" runat="server"/>
</form>
Class file source
void Page_Load(Object sender, EventArgs e)
{
// Manually register the event-handling method for the Command
// event of the Button controls.
Button1.Command += new CommandEventHandler(this.CommandBtn_Click);
Button2.Command += new CommandEventHandler(this.CommandBtn_Click);
Button3.Command += new CommandEventHandler(this.CommandBtn_Click);
Button4.Command += new CommandEventHandler(this.CommandBtn_Click);
Button5.Command += new CommandEventHandler(this.CommandBtn_Click);
}
void CommandBtn_Click(Object sender, CommandEventArgs e)
{
switch(e.CommandName)
{
case "Sort":
// Call the method to sort the list.
Sort_List((String)e.CommandArgument);
break;
case "Submit":
// Display a message for the Submit button being clicked.
Message.Text = "You clicked the <b>Submit</b> button";
// Test whether the Command Argument is an empty string ("").
if((String)e.CommandArgument == "")
{
// End the message.
Message.Text += ".";
}
else
{
// Display an error message for the command argument.
Message.Text += ", but the command argument is not recogized.";
}
break;
default:
// The command name is not recognized. Display an error message.
Message.Text = "Command name not recogized.";
break;
}
}
I suggest you to use asp.net menu control to manually create static menus based on you Flash menu.
Also check this third party tools:
http://www.flashkeeper.com/publishhtml.htm
http://www.geovid.com/
Use this sample code
using System;
using System.Data;
public partial class DemoCheckBoxList : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Bind CheckBoxList on page load
if (!IsPostBack)
BindCheckBoxList();
}
private void BindCheckBoxList()
{
//You can load the following DataTable from a database
DataTable dtBooks = new DataTable();
dtBooks.Columns.Add("Is_Chosen", System.Type.GetType("System.Boolean"));
dtBooks.Columns.Add("Book_Name", System.Type.GetType("System.String"));
dtBooks.Rows.Add(new object[] { true, "ASP.NET Programming" });
dtBooks.Rows.Add(new object[] { true, "Beginning Web Development" });
dtBooks.Rows.Add(new object[] { false, "ASP.NET for Dummies" });
dtBooks.Rows.Add(new object[] { true, "SharePoint 2007" });
dtBooks.Rows.Add(new object[] { false, "PHP Programming" });
//Binding DataTable to the CheckBoxList control
cblBooks.DataSource = dtBooks;
cblBooks.DataTextField = "Book_Name";
cblBooks.DataValueField = "Is_Chosen";
cblBooks.DataBind();
//Select/Unselect checkboxes based on the value of 'Is_Chosen' boolean column
//of the DataTable
for (int i = 0; i < dtBooks.Rows.Count; i++)
cblBooks.Items[i].Selected = (Boolean)dtBooks.Rows[i]["Is_Chosen"];
}
}
The comparison seems to be ok.
Can you post the code on how you are binding the GridView and also its HTML?
Try this
SELECT TOP 100 *
FROM Your_Table_Name
ORDER BY NEWID()
This will pick 100 records randomly from a SQL Server 2005 table.
Does kosar.Rows.Cells[0].Text return string value?
For example if the argument 'name' is 'Product1' and the value of 'kosar.Rows.Cells[0].Text ' is also 'Product', but the condition kosar.Rows.Cells[0].Text == name returns false.
Did you mean the above scenario?
Just change 'If rdr.HasRows' to 'If rdr.Read()'
Therefore your code should be as follows
If rdr.Read() Then
If ddltype.SelectedValue = "Customer" Then
Session("ses_dname") = rdr("CusFName") + " " + rdr("CusLName")
Session("ses_uid") = rdr("Cusid")
Response.Redirect("Home1.aspx")
'ElseIf
' ddltype.SelectedValue = "Delivery Boy" Then
' Session("ses_dname") = rdr("FirstName") + " " + rdr("Lastname")
' Session("ses_uid") = rdr("staffid")
'Session("ses_utype") = rdr("Designation")
'Response.Redirect("DeliveryBoyDirection.aspx")
Else
ddltype.SelectedValue = "DeliveryBoy"
Session("ses_uname") = rdr("FirstName") + " " + rdr("LastName") Session("ses_uid") = rdr("staffid")
Session("ses_utype") = rdr("Designation")
Response.Redirect("DeliveryBoyDirection.aspx")
End If
End If
This is the HTML source viewed in my IE8. The same is viewed in http://www.oxonacf.org.uk/test.aspx also.
<!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"><title>
Test Page
</title><meta name="ROBOTS" content="NOINDEX" /></head>
<body>
<form name="form1" method="post" action="TestPage11.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTA4OTU2ODYyMw9kFgICAw9kFgICBQ8PFgIeBFRleHQFK0J1dHRvbjFfQ2xpY2sgZmlyZWQgYXQgNy83LzIwMDkgMTA6MDQ6NDcgUE1kZGRpowb0CyldCDBRuX+q0ABj19Zgog==" />
</div>
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBQK/x8UUAuzRsusGAoznisYGAuzR9tkMArursYYI6vzYosbpPS4bH3+PLel4Gwkqpdo=" />
</div>
<div id="Panel1" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'Button1')">
<input name="TextBox1" type="text" id="TextBox1" />
<input type="submit" name="Button1" value="Button1" id="Button1" />
</div>
<div id="Panel2" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'Button2')">
<input name="TextBox2" type="text" id="TextBox2" />
<input type="submit" name="Button2" value="Button2" id="Button2" />
</div>
<span id="Label1">Button1_Click fired at 7/7/2009 10:04:47 PM</span>
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
<script src="/Site3/WebResource.axd?d=a89fGCglRfUbEVx19IXx7g2&t=633658105131718750" type="text/javascript"></script>
</form>
</body>
</html>
1. Impersonation will not require any account. It is optional.
2. setting it to true work for all users then with each thier own folder and privileges. This is true.
3. If you set any account, then the application uses the privileges of that account to access the folder.
I have tested your code in IE8 and Opera. It is working fine.
But it is not working if URL in your question is viewed in IE8 and opera. Also both browsers re emitted with proper HTML.
Sorry. I could n't find the problem.