|
Hi,
When manually binding an SqlDataSource, sorting and paging does not work on the GridView. Is there some kind of settings or code to make the sorting and paging work?
SqlDataSource1.SelectCommand() = sSQL
GridView1.DataSource = SqlDataSource1
GridView1.DataBind()
Note that when the SqlDataSource1 and the GridView is bind at design, the sort and paging work fine.
Thank you.
|
|
|
|
|
My problem is that I can't put the html that is rendered by my .aspx file into a pdf file using itextsharp.
the aspx file does not contain any pictures.
BiG RaLpH
|
|
|
|
|
i have a document library (named: Outstandings) which contain word cosuments, i searched a document (named: Balance_343,35725.doc) within this library , i ahve some columns in this library, i want to change the value of column/filed(named: Document Library) , how can i change the value of field? (actually i want to show a library name as link in the clumns in front of document)
This is my code:
SPSite sitecollectiont = SPControl.GetContextSite(Context);
SPWeb sitet = sitecollectiont.OpenWeb();
sitet.AllowUnsafeUpdates = true;
SPListCollection lists = sitet.Lists;
foreach (SPList list in lists)
{
if (list.Title == "Outstandings") //this D. library
{
SPListItemCollection items = list.Items;
foreach (SPListItem item in items)
{
SPFile file = item.File;
string docName = file.Name;
if (docName.Equals("Balance_343,35725.doc"))
{
SPField field = item.Fields.GetField("Document Library"); //this is column name
field.DefaultValue = "1234";
field.Update(true);
return;
}
}
}
but setting its value by defaultValue necver worked.
Please help to set the value as a link to Library.
Thanks
Needo
|
|
|
|
|
hi
i'd like to know how can i only get date part of a variable not the time part
for example i have a variable that its value is "1/1/2000 12:00AM" and i only want "1/1/2000"
thank you
|
|
|
|
|
myDate.ToShortDateString()
|
|
|
|
|
how can i specify certain file formats to be browsed by file upload control?
for example i just like my file upload control to browse JPG and GIF files
thank you
|
|
|
|
|
I tried this but there no way that you can show a specific type of files howerver after browsing you can check the extension and prompt the appropriate message.
Shujaat
|
|
|
|
|
I am using a Gridview which is getting it's data from a Stored procedure. The values passing to the stored procedure are coming from a QueryString.
When I run the GridView configuration the correct data is returned when I test the connection but when I run it, the gridview page just comes back blank and displays nothing.
Anyone any ideas?
macca
|
|
|
|
|
It sounds as though you are missing a call to the DataBind() method of the gridview after settings its DataSource .
|
|
|
|
|
Thanks for the reply Brent but:
How and where can I set this?
macca
|
|
|
|
|
Hmm you must be using the visual interface to to get your data rather than coding your own data access layer. In that case I won't be able to help much ( I prefer to code my own DAL) other than to say it sounds as though your gridview is not bound to the data source correctly.
|
|
|
|
|
Brent, Got this sorted. I coded instead.
Thanks,
macca
|
|
|
|
|
when a network is said to be intranet and when it said to be internet and when it said to be extranet? And anybody knows about the technical issues to make the network intranet,please share with me
Thank you
|
|
|
|
|
Typing that into Google would have been faster!
But because you made me curious: http://www.hcidata.info/inet.htm
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
The internet is just the entire net, without any limitations or specific purpose. An intranet is used to share information in a local network. An extranet is basically an intranet that you can access from outside the local network. Usually the only difference is which people you give a login to, i.e. an intranet can physically be an extranet because you can reach it from anywhere, but it's only used by people inside the company.
Wikipedia: intranet[^]
Wikipedia: extranet[^]
---
single minded; short sighted; long gone;
|
|
|
|
|
I have a question regarding Asynchronous Requests.
Is there some way the requests can be made to operate at the same time?
i have one button on the page. 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.
Looking forward to your reply. Thanks in advance.
Regards,
Ishfaq Hussain
-----------------------------Sample.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Sample.aspx.cs" Inherits="_sample" %>
DisplayAfter="0">
DisplayAfter="0">
Updating panel3
DisplayAfter="0">
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)ageAsyncTask 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();
}
}
------- Tasks.cs---------------------
using
System;
using
System.Data;
using
System.Configuration;
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;
///
///
Summary description for Tasks
///
public
class Tasks
{
//private Guid _guid;
private int _taskID;
private string _orderID;
private string _startTime;
private string _endTime;
private float _amount;
//public Guid guid
//{
// get
// {
// return _guid;
// }
// set
// {
// _guid = value;
// }
//}
public int TaskID
{
get
{
return _taskID;
}
set
{
_taskID =
value;
}
}
public string OrderID
{
get
{
return _orderID;
}
set
{
_orderID =
value;
}
}
public string StartTime
{
get
{
return _startTime;
}
set
{
_startTime =
value;
}
}
public string EndTime
{
get
{
return _endTime;
}
set
{
_endTime =
value;
}
}
public float Amount
{
get
{
return _amount;
}
set
{
_amount =
value;
}
}
}
Ishfaq Hussain
|
|
|
|
|
Hi All
the Problem I am facing is that I am using RadioButtonList which is created Dynamically.
All I have to do is to trap the events of this RadioButtonList using JavaScript. and create 2 other controls on change selection of this RadioButtonList.
to add further to this is that I do not know the ClientID for items in RadioButtonList at the point of compilation.
Dream'Z Unlimited
|
|
|
|
|
No probs you need to register the javascript from server side so one thing pass the clientid of the radiobutton list from server i.g
<br />
RadioButton objects = new RadioButton();<br />
objects.ID = "Somthing";<br />
objects.Text = "Click me";<br />
this.Page.Form.Controls.Add(objects);<br />
<br />
objects.Attributes.Add("OnClick", "javascript:alert('"+objects.ClientID+"');");<br />
<br />
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... "
|
|
|
|
|
hi
im using visual studio 2005 which has default crystal reports ,but when i add a new crystal report file, i am unable to insert chart's, since the chart is disabled from my menu in visual studio 2005, how to enable this chart option in visual studio 2005
regards
winnie
|
|
|
|
|
i wanted to ask the example (a real life example) that pertains to the passport authentication.
According to my understanding it should be MSN Messenger
Is it right?
Soniagupta1@yahoo.co.in
|
|
|
|
|
Passport authentication is simply a single sign on system that was developed by Microsoft. Basically this means that you should be able to sign into site B using exactly the same login mechanism as signing into site A because they both implement Passport authentication.
Passports are issued, maintained and validated by a central authority so sites don't need to maintain this issue themselves. All they need to do is call the relevant web service to authenticate a user and then provide access based on this process.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi All
i am using form based authentication in my web site. In my login page there is a linked button Forgot Password but when we click on this button i am unable to move the forgotpasword.ascx page. I am using user control for the both login page and the ForgotPassword page these usere control is placed on the respective page.
the code is using in the web config is
<authentication mode="Forms">
<forms name=".SDWADMIN" loginurl="Login.aspx" protection="All" timeout="5000" path="/">
<authorization>
<deny users="?">
plese look into it and please suggest me
Regards
Saurabh
-- modified at 7:19 Thursday 13th September, 2007
-- modified at 7:20 Thursday 13th September, 2007
-- modified at 7:22 Thursday 13th September, 2007
Saurabh Gupta
Software Engineer
|
|
|
|
|
Hi Saurabh,
Once i also faced same problem but i wasn't using user control.
I made these changes in web.config file and it works.
Just add these tags in ur web.config file below </system.web> tag.
<location path="Forgetpassword.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
I am not sure wether it'll work or not but u can try it out.
Nagendra
|
|
|
|
|
Thanks for your suggestiob Nagendra
i have tried but it is not working in user contrl do you have any other suggestion.
Saurabh Gupta
Software Engineer
|
|
|
|
|
forgotpasword.ascx page
.ascx is not a page. Its just Usercontrol so u cant move
Best Regard
Pathan
---------------------------------------------------
|
|
|
|