|
usig the fileupload control i have selected a file and the path of that file s shown in the control.
how to get that path of a file ...
|
|
|
|
|
What you have to do with the path of the client machine ?
as you are going to store it at server
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Actually wat u need .. u need the path of that file or only the filename..
fileUploader1.Filename is for filename
filePath = FileUploader1.PostedFile.FileName is for full path
Sarith...
|
|
|
|
|
i have a delete button and a gridview in which the first column is a checkbox .
the checkboxes are checked and then when delete button is pressed a confirm box comes Are you sure you want to delete.on cancel of it i want to uncheck the checkboxes through javascripting . How to do this. How to get the individual checkboxes id.
here is want i have done but could not get it.
function CheckUser(gvView)
{
debugger
var usergid = document.getElementById(gvView);
var len = usergid.rows.length;
if(checked)
{
var conf = confirm(" Are you sure to delete 'User(s)'");
if(conf)
{
return true;
}
else
{
var usergid = document.getElementById(gvView);
checked=false;
n=1;
for(k=1;k<=Count+1;k++)
{
n=n+1;
var ChkDel = gvView+'_'+'ctl0'+n+'_'+'chkDelete';
if(n>=10)
{
ChkDel =gvView+'_'+'ctl'+n+'_'+'chkDelete';
}
var checkbox=document.getElementById(ChkDel)
if(checkbox!=null)
{
if(checkbox.checked)
{
checked=false;
}
}
}
return false;
}
}
else
{
alert("Please select atleast one 'User'");
return false;
}
}
|
|
|
|
|
The function below is to check and uncheck the entire Checkbox column, you need to do some changes to for ur requirment:
Call will be as follows:
<asp:CheckBox ID="CheckAll" Text="Check all" runat="server" onclick="return check_uncheck (this );" />
Function starts here:
function check_uncheck(Val)
{
var ValChecked = Val.checked;
var ValId = Val.id;
var frm = document.forms[0];
// Loop through all elements
for (i = 0; i < frm.length; i++)
{
// Look for Header Template's Checkbox
//As we have not other control other than checkbox we just check following statement
if (this != null)
{
if (ValId.indexOf('CheckAll') != - 1)
{
// Check if main checkbox is checked,
// then select or deselect datagrid checkboxes
if (ValChecked)
frm.elements[i].checked = true;
else
frm.elements[i].checked = false;
}
else if (ValId.indexOf('deleteRec') != - 1)
{
// Check if any of the checkboxes are not checked, and then uncheck top select all checkbox
if (frm.elements[i].checked == false)
frm.elements[1].checked = false;
}
} // if
} // for
}
|
|
|
|
|
set DataKeyNames as primarykeyId
<asp:GridView ID="gvInComplete" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None" DataKeyNames="PrimaryKeyID">
<br />
DataKey key;<br />
foreach (GridViewRow row in gvInComplete.Rows)<br />
{<br />
bool result = ((CheckBox)row.FindControl("chkSelect")).Checked;<br />
if (result)<br />
{<br />
key = gvInComplete.DataKeys[row.RowIndex];<br />
int primaryKey = (int)key.Value);<br />
}<br />
} <br />
for more about checkbox javascript issues go through
this link [^]
Ramana
|
|
|
|
|
Good Day Every Body
hi ,
i have a xml file with product and there prices,
and i want to display only those products on datgrid whose prices are greater than 100.
What can be solutions,
Thanx in advance,
|
|
|
|
|
Try this:
private void BindGridViewFromXML()
{
dt = new Datatable();
dt.ReadXml(Request.PhysicalApplicationPath + "EditableGridView\\" + "XMLFile.xml");
//Fire a query on dt to get the all the products whose price is > 100
gvGrid.DataSource = dt;
gvGrid.DataBind();
}
Hope this helps u...
|
|
|
|
|
Hi ,
need i have to use connection to get this functionality or can i use xml file directly to get the required products data.
|
|
|
|
|
Yes u need to take data from XML File therefore file should be exist already and u just need to give path and rest all u know how to do. If still u have problem then post a new message.
|
|
|
|
|
hello i am new to this active reports i need to design a page in active report .I dont know how to design a page in active report can any one give me some links .I need links from scratch so that i can understand how to design the page in active report.I am using asp . I need to design one fax cover sheet in active report(i.e pdf format ) . I dont know how to design can any one help me out .
|
|
|
|
|
Hi,
How to add new row dynamic into dataset.
thanks
|
|
|
|
|
ds.Tables[0].Rows.Add();
Ramana
|
|
|
|
|
Hi,
thanks for reply.
I am doing like this
Suppose i am inserting two records.then
first it's insert blank row then insert the next record.
i am getting why?
My Code:-
DataRow dr = dsCostAdminDetails.Tables[0].NewRow();
dr.Table.Columns["date"].DefaultValue = Convert.ToString(
dtDate.AddDays(-lngTotalDays).ToShortDateString());
dsCostAdminDetails.Tables[0].Rows.InsertAt(dr, bteCounter);
|
|
|
|
|
i want code for forms authentication ,where multiple users are accessing the site i want the code in c#.net
please forward the code to me as soon as possible
sai S/W Developer DATA MONITOR
|
|
|
|
|
|
see i had done the coding for login using forms authentication in web.config file but when i put home page as startup page it is not displaying ----the error is "the page cannot be displayed"
please help me
sai
|
|
|
|
|
Hi
I have a windows application i am calling webserivce, the first webservice calling another webservice there i am getting an error
The request failed with the error message:
--
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="/webservuce2/service.asmx?AutoDetectCookieSupport=1">here</a>.</h2>
</body></html>
--.
kesavan
|
|
|
|
|
Hi
I have created a user control which inherits from UserControl amd implements ITemplate. I am setting my datalist's item template to this external resource using Page.LoadControl. But when the datalist is bound to a datasource, I don't see the data displayed in the expected way. Only the last item in the datasource is displayed by the datalist for the item template colum.
Here is my class.
UserControl code behind
========================
<br />
public partial class StateListTemplate : System.Web.UI.UserControl, System.Web.UI.ITemplate<br />
{<br />
private bool _bDisplayStateName = false;<br />
<br />
public bool DisplayStateName<br />
{<br />
set {_bDisplayStateName = value;}<br />
get { return _bDisplayStateName;}<br />
}<br />
<br />
public void InstantiateIn(System.Web.UI.Control container)<br />
{<br />
container.Controls.Add(this);<br />
}<br />
....<br />
protected string GetStateDisplayString(string sStateCode, string sStateName)<br />
{<br />
if (DisplayStateName)<br />
return new System.Text.StringBuilder(sStateCode.Trim()).Append("-").Append(sStateName.Trim()).ToString();<br />
else<br />
return sStateCode;<br />
}<br />
<br />
User Control .ascx
==================
<br />
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="StateListTemplate.ascx.cs" Inherits="EtaxWeb.UserControls.StateListTemplate" %><br />
<asp:Label runat="server" Text="Test1"></asp:Label><br />
<%# GetStateDisplayString((string)DataBinder.Eval(((DataListItem)Container).DataItem, "Value"), (string)DataBinder.Eval(((DataListItem)Container).DataItem, "Text"))%><br />
Code where the datalist's itemtemplate is set to the above user control and datbound.
<br />
StateListTemplate stlist = (StateListTemplate)LoadControl("../UserControls/StateListTemplate.ascx");<br />
stlist.DisplayStateName = false;<br />
dlStates.ItemTemplate = stlist;<br />
dlStates.DataSource = states;<br />
dlStates.DataBind();<br />
I could have just used a class with ITemplate interface, but just wanted to see if this is possible as it would help to code the controls declaritively in the user control and add it to the container in the InstantiateIn method rather than having to declare eacha nd every control and adding it to the container.
Any Help is appreciated!
|
|
|
|
|
W.R.T .Net 2.0
1>Is there any way i can remove the space between the outer border of the checkbox and the actual check box.
2>I have a fileupload control, how can i apply style to the browse button.
|
|
|
|
|
Is there some way the requests can be made to operate at the same time?
i have one button. everytime user clicks the button a call to database is made Asynchronously and the results are shown in the grid on completion. For every database result there is a new row in the grid. The problem is, every asynchronous call executes after the previous one is completed showing a behaviour of queues. However i need pure asynchronous tasks that is the results of less time consuming should appear first even if it was started at later. for more clarity here is code for both aspx and aspx.cs. before executing this code please make sure the connection string is ok for your machine. on execution click the button immidiately more than one times and see the start and end times.
Thanks in advance.
Regards,
Ishfaq Hussain
-----------------------------Sample.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Sample.aspx.cs" Inherits="_sample" %>
<title>Untitled Page
<asp:scriptmanager id="ScriptManager1" runat="server">
<asp:updatepanel id="UpdatePanel1" runat="server">
<contenttemplate>
<asp:label id="Label1" runat="server" text="Label">
<asp:button id="Button1" runat="server" onclick="Button1_Click" text="Button">
<asp:gridview id="gridTasks" runat="server">
<asp:updateprogress id="UpdateProgress1" runat="server" associatedupdatepanelid="UpdatePanel1"
displayafter="0">
<progresstemplate>
<asp:updatepanel id="UpdatePanel2" runat="server">
<contenttemplate>
<asp:label id="Label2" runat="server" text="Label" visible="False">
<asp:button id="Button2" runat="server" onclick="Button2_Click" text="Button" visible="False">
<asp:updatepanel id="UpdatePanel3" runat="server">
<contenttemplate>
<asp:label id="Label3" runat="server" text="Label" visible="False">
<asp:button id="Button3" runat="server" onclick="Button3_Click" text="Button" visible="False">
<asp:updateprogress id="UpdateProgress3" runat="server" associatedupdatepanelid="UpdatePanel3"
displayafter="0">
<progresstemplate>
Updating panel3
<asp:updateprogress id="UpdateProgress2" runat="server" associatedupdatepanelid="UpdatePanel2"
displayafter="0">
<progresstemplate>
Updating panel2
Sys.Application.add_load(ApplicationLoadHandler)
function ApplicationLoadHandler(sender, args)
{
var prm = Sys.WebForms.PageRequestManager.getInstance();if (!prm.get_isInAsyncPostBack())
{
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(CompleteRequest);
}
}
// initialize a queue
var myQueue = new Array();
function CompleteRequest(sender, args)
{
if(myQueue.length > 0)
{// fire correspond event again of the item cached
$get(myQueue[0].id).click();
Array.removeAt(myQueue, 0);
}
}
function InitializeRequest(sender, args)
{
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm.get_isInAsyncPostBack())
{// if it's working on another request, cache the current item that cause the request
args.set_cancel(true);
Array.add(myQueue, args.get_postBackElement());
}
}
if(typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();
-----------------------------Sample.aspx.cs
using System;
using System.Data;
using System.Data.SqlClient;
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;
public partial class _sample : System.Web.UI.Page
{
DataTable dt = new DataTable();
private SqlConnection conn;
private SqlCommand command;
private SqlDataReader _reader;
private int ThreadCount=0;protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
dt.Columns.Add("Task ID");
dt.Columns.Add("Order ID");
dt.Columns.Add("Start Time");
dt.Columns.Add("End Time");
dt.Columns.Add("Order Amount");
ViewState["dt"] = dt;Session["ThreadCount"] = ThreadCount;
}
dt = (DataTable)ViewState["dt"];
ThreadCount =(int) Session["ThreadCount"];
}
protected void Button1_Click(object sender, EventArgs e)
{
ThreadCount++;
Session["ThreadCount"] = ThreadCount;
//Response.Write(Request.QueryString["values"]);
//Response.Write("Request No" + ThreadCount.ToString() + " ");
Label1.Text = ThreadCount.ToString();
Random rand = new Random();
int n = rand.Next(10000, 11077);
//Guid taskId = Guid.NewGuid();
int taskId = ThreadCount;
string stime = System.DateTime.Now.TimeOfDay.ToString();
Tasks task = new Tasks();
//task.guid = taskId;
task.TaskID = taskId;
task.OrderID = n.ToString();
task.StartTime = stime;
//AddListViewItem(task.guid, int.Parse(task.OrderID), task.StartTime);
AddListViewItem(task.TaskID, int.Parse(task.OrderID), task.StartTime);PageAsyncTask asynctask = new PageAsyncTask(BeginAsyncOperation, EndAsyncOperation, EndTimeOutInvoke, task);
RegisterAsyncTask(asynctask);
}
IAsyncResult BeginAsyncOperation(object sender, EventArgs e, AsyncCallback cb, object state)
{
Tasks task = (Tasks)state;
conn = new SqlConnection("Data Source=localhost;Initial Catalog=Northwind; Integrated Security=true; Asynchronous Processing=true");
command = new SqlCommand();
command.CommandText = "WAITFOR DELAY '0 " + new Random().Next(1, 9) + "' SELECT isnull(sum((UnitPrice * Quantity)-Discount),0) from [Order Details] WHERE OrderID = " + int.Parse(task.OrderID);
//command.CommandText = "SELECT isnull(sum((UnitPrice * Quantity)-Discount),0) from [Order Details] WHERE OrderID = " + n;
command.Connection = conn;
conn.Open();
//SqlDataReader dr = command.ExecuteReader();
//etime = System.DateTime.Now.TimeOfDay.ToString();
//DataTable dt = new DataTable();
//dt.Load(dr);
return command.BeginExecuteReader(cb, task);
}
void EndAsyncOperation(IAsyncResult ar)
{
_reader = command.EndExecuteReader(ar);
string etime = System.DateTime.Now.TimeOfDay.ToString();DataTable tempdt = new DataTable();
tempdt.Load(_reader);
UpdateListViewItem((Tasks)ar.AsyncState, float.Parse(tempdt.Rows[0][0].ToString()), etime);
}
public void EndTimeOutInvoke(IAsyncResult result)
{
//if (cnx != null && cnx.State != ConnectionState.Closed)
// cnx.Close();
Response.Write("TimeOut");
Response.End();
}
protected void Page_PreRenderComplete(object sender, EventArgs e)
{
//gridTasks.DataSource = dt;
//gridTasks.DataBind();
}
private void AddListViewItem(
//Guid guid,
int taskID,
int testNumber,
string sTime)
{
DataRow drow = dt.NewRow();
//drow["Task ID"] = guid.ToString();
drow["Task ID"] = taskID.ToString();
drow["Order ID"] = testNumber.ToString();
drow["Start Time"] = sTime;
drow["End Time"] = "---";
drow["Order Amount"] = "---";
dt.Rows.Add(drow);
gridTasks.DataSource = dt;
gridTasks.DataBind();
}
private void UpdateListViewItem(
Tasks task,
float Amount,string eTime
)
{
try
{
int i = 0;foreach (DataRow drow in dt.Rows)
{
//if ((Guid)lvi.Tag == guid)
//Guid g = new Guid(drow["Task ID"].ToString());
int tid = int.Parse(drow["Task ID"].ToString());if (tid == task.TaskID)
{
//drow["End Time"] = eTime;
//drow["Order Amount"] = Amount.ToString();
dt.Rows[i]["End Time"] = eTime;dt.Rows[i]["Order Amount"] = Amount.ToString();
dt.AcceptChanges();
break;
}
i++;
}
gridTasks.DataSource = dt;
gridTasks.DataBind();
}
catch (Exception ex)
{
}
}
protected void Button2_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(2000);Label2.Text = DateTime.Now.ToLongTimeString();
}
protected void Button3_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(2000);
Label3.Text = DateTime.Now.ToLongTimeString();
}
}
|
|
|
|
|
Hi All,
I need to use AJAX CascadingDropDown and AutoCompleteExtender together, i mean I have to combine these two controls but I am not getting how to do this.
My code is works fine if I use these two controls separately but when I combine these 2 controls, I dont get the proper result.
Please help me...
Thanks in advance...
|
|
|
|
|
AutoCompleteExtender Control is used for Textbox.It returns result of string on KeyChange event of TextBox. CascadingDropDown Control is used for multiple DropdownList.
I combine these 2 controls
Can U tell me How did u combine these two controls.?
Best regard
Pathan
---------------------------------------------------
|
|
|
|
|
Some what like this:
"
<code>
<ajaxToolkit:CascadingDropDown ID="CascadingDropDown4" runat="server" TargetControlID="ddlCompany"
ParentControlID="ddlSubIndustry" Category="Company" PromptText="Select Company"
ServicePath="AutoComplete.asmx" ServiceMethod="GetTicker" />
<asp:DropDownList ID="ddlCompany" runat="server" Width="222px"
OnSelectedIndexChanged="ddlCompany_SelectedIndexChanged">
</asp:DropDownList>
<asp:TextBox runat="server" ID="myTextBox" Width="234px" autocomplete="off" Style="font-size: 9pt"
CssClass="blue-text" Height="14px" />
<ajaxToolkit:AutoCompleteExtender runat="server" ID="autoComplete1" TargetControlID="myTextBox"
ServicePath="AutoComplete.asmx" ServiceMethod="GetCompletionList1" MinimumPrefixLength="0"
CompletionInterval="1000" EnableCaching="true" CompletionSetCount="12"
CompletionListElementID="ddlCompany" /> </code> "
|
|
|
|
|
What is CompletionListElementID in AutoCompleteExtender?.and Why did u use dropdownlist 'ddlCompany' in AutoCompleteExtender?
Can I see GetCompletionList1 Method?
Best Regard
Pathan
---------------------------------------------------
|
|
|
|