|
Check out the <asp:Login /> control (and related), with the only really important event the Authenticate event.
-Domenic Denicola-
|
|
|
|
|
I really can't figure this one out; sorry guys.
I have a pretty-standard WCF service, with a contract something like this:
[ServiceContract(Namespace="http://www.domenicdenicola.com/")]
public interface IMyService
{
[OperationContract]
[WebInvoke]
void PerformBigOperation();
[OperationContract]
[WebInvoke]
int GetProgress();
}
I generate the ASP.NET AJAX proxy class in the usual way:
<asp:ScriptManager ID="ScriptManager" runat="server">
<Services>
<asp:ServiceReference Path="MyService.svc" />
</Services>
</asp:ScriptManager>
I then call them from JavaScript like so:
var service = new www.domenicdenicola.com.IMyService();
function UpdateProgress()
{
service.GetProgress(function onSuccess(result)
{
$get("Status").innerHTML = result + " % complete…";
setTimeout(UpdateProgress, 1500);
});
}
function PerformBigOperation()
{
setTimeout(UpdateProgress, 1500);
service.PerformBigOperation(function onSuccess(result)
{
$get("Status").innerHTML = "Done.";
});
} where PerformBigOperation is called upon clicking a button, and Status is the ID of a status <p /> tag.
I also have set Async="True" in my <%@ Page %> directive. (This seems to make no difference.) My web.config contains the following relevant sections:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<extensions>
<behaviorExtensions>
<add name="enableWebScript" type="(a long string)"/>
</behaviorExtensions>
<bindingExtensions>
<add name="webHttpBinding" type="(a long string)"/>
</bindingExtensions>
</extensions>
<bindings>
<webHttpBinding/>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceThrottling maxConcurrentCalls="1000" maxConcurrentSessions="1000"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="EndpointBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="Behavior" name="MyService">
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="EndpointBehavior" contract="IMyService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
The problem is, the first call to the service blocks the second one, so GetProgress never returns until after PerformBigOperation is finished, by which point it is, of course, useless. Any ideas!?!
-Domenic Denicola-
|
|
|
|
|
Hi This is my code.
I want to read values from the DB and Store the values in Different cells in gridview is it possible.Help me.....
string executesp = "exec C_Detail '" + Label1.Text.Trim() + "'";
SqlCommand cmd = new SqlCommand(executesp, connect);
connect.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
for (int i = 0; i < 10; i++)
{
string columnindex = dr["COLUMNINDEX"].ToString();
int columnIndex = Convert.ToInt32(columnindex);
string headertypetop = dr["HEADERTYPETOP"].ToString();
string day = dr["DAY"].ToString();
string month = dr["MONTH"].ToString();
string year = dr["YEAR"].ToString();
string rowid = dr["ROWID"].ToString();
for(int j = 0 ; j<= columnIndex ;j++)
{
GridView1.Rows[j].Cells[1].Text = columnindex;
}
}
}
connect.Close();
Bharani
|
|
|
|
|
Hi,
Yes I think it’s possible.
Just a quick tip...I feel you better get the data to a DataTable and bind it directly.
For example:
Fill the data to a datatable.
string sConnection = ConfigurationManager.ConnectionStrings["TestDBConnectionString"].ConnectionString;
SqlConnection Con = new SqlConnection(sConnection);
SqlCommand cmd = new SqlCommand();
cmd.Connection = Con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "Employee_Select";
SqlDataAdapter adp = new SqlDataAdapter(cmd);
DataTable dtValues = new DataTable();
adp.Fill(dtValues);
Bind it to gridview.
GridView1.DataSource = dtValues;
GridView1.DataBind();
In the .aspx page
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="EmployeeNumber" HeaderText="Emp. No:" />
<asp:BoundField DataField="Name" HeaderText="Name" />
</Columns>
</asp:GridView>
Hope it solves.
Thx,
Gayani
|
|
|
|
|
Yes i got the answer Thans for ur reply
Bharani
|
|
|
|
|
Hi
I have a common methods class in my app_folder
In there I am trying to delcare a session but I get the following error message:
The name 'Session' does not exist in the current context
why would this be? can you not declare them in a class in app_folder?
thanks in advance
|
|
|
|
|
.netman wrote: The name 'Session' does not exist in the current context
You can access it by using
HttpContext.Current.Session .
Regard
Khan
please don't forget to vote on the post that helped you.
|
|
|
|
|
The session hasnt been set up yet though I am trying to create it, but it is showing the error message
thanks anyway
|
|
|
|
|
.netman wrote: but it is showing the error message
Tried HttpContext.Current.Session ? Are you writing this in any event which fires before session gets initialized ?
|
|
|
|
|
Dont worry I am not going to use session anymore, thanks for the help though
|
|
|
|
|
if the page number =1 ,link button should be disable.
if the page number =2 ,link button should be enable.
i tried
linkbutton.enabled=false. this is not working.
plz guide me.
|
|
|
|
|
Well can you display your if statement so we can see what is happening, there could be a number of reasons.
What event is your code in?
|
|
|
|
|
This is my code
protected void lnkPrevious_Click(object sender, EventArgs e)
{
if (this.PageNumber ==1)
{
lnkPrevious.Enabled = false;
lnkNext.Enabled = true;
Response.Redirect("pge1.aspx");
}
else
{
this.PageNumber -= 1;
Response.Redirect( "pge"+this.PageNumber.ToString()+".aspx");
}
}
|
|
|
|
|
kathyani wrote: this.PageNumber -= 1;
why have you got a '-' in front of the '='?
|
|
|
|
|
iam having 11 pages.
iam in 7th page.
if i click previous btn it will go to 6th page .thats why i put
this.pagenumber-=1;
|
|
|
|
|
kathyani wrote: Response.Redirect("pge1.aspx");
What is page1.aspx?
If it is the current page, Then It will be depend upon the design of the page(if you are not not set the enabled property at design time,by default it will be enabled).
So
kathyani wrote: lnkPrevious.Enabled = false;
Disable your link button, but
kathyani wrote: Response.Redirect("pge1.aspx");
will Enable it.
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
|
|
|
|
|
iam having 1 to 11 link buttons.
if i click 1 button previous button should be disable.
if i move 2 nd button it should be enable.
|
|
|
|
|
Try this, First redirect then disable the button.
protected void lnkPrevious_Click(object sender, EventArgs e)
{
if (this.PageNumber ==1)
{
Response.Redirect("pge1.aspx");
lnkPrevious.Enabled = false;
lnkNext.Enabled = true;
}
else
{
this.PageNumber -= 1;
Response.Redirect( "pge"+this.PageNumber.ToString()+".aspx");
}
}
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
|
|
|
|
|
above code is not working..
thanks ..
|
|
|
|
|
Ya,I'm really sorry, It wont work.
Try this in your page load
if(this.PageNumber ==1)
lnkPrevious.Enabled = false;
else
lnkPrevious.Enabled = true;
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
|
|
|
|
|
its working.
Thanks a lot...
|
|
|
|
|
i have one problem..
iam getting error .plz guide me .
public partial class PagerControl : System.Web.UI.UserControl
{
private int _pageNumber;
public int PageNumber
{
set
{
_pageNumber = value;
ViewState["PageNumber"] = value;
}
get
{
return int.Parse(ViewState["PageNumber"].ToString());
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (this.PageNumber == 1)
{
lnkPrevious.Enabled = false;
}
else
{
lnkPrevious.Enabled = true;
}
if (this.PageNumber == 11)
{
lnkNext.Enabled = false;
}
else
{
lnkNext.Enabled = true;
}
}
Server Error in '/ucnew' Application.
--------------------------------------------------------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 22: get
Line 23: {
Line 24: return int.Parse(ViewState["PageNumber"].ToString());
Line 25: }
Line 26: }
|
|
|
|
|
problem is :
You are calling PageNumber in this line ---> if (this.PageNumber == 1) before you have set the value. So you are getting that error. Set the value first then you must do a get.
To Fix this:
Write a contructor of your class and inside the constructor set the value of _pageNumber = 1 or 0 as per your requirement.
sample code here!!!
public PagerControl()
{
_pageNumber = 1;
}
Thanks,
Arindam D Tewary
|
|
|
|
|
Hi arindam ..
i didnt get .
plz guide me in code level ..
|
|
|
|
|
i did'nt get.
plz tell me clearly..
|
|
|
|