|
Hi, i have done this in this way.
rng=elem.createTextRange();<br />
rng.findText(val.substring(start,end));<br />
rng.select();
Thanks for your help !!!
cheers,
Abhijit
|
|
|
|
|
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
|
|
|
|
|
but i am geeting 1 problem,if there is same entry , first one is selected
any idea !!!
cheers,
Abhijit
|
|
|
|
|
You must rewrite the logic of finding the "start" and "end".
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
|
|
|
|
|
Hi,
I am newbie to asp.net C#, so I am not sure how to read the data from SQL Express database and validate the user input from the database using asp.net C#. Mostly from book and internet are in VB language. I don't want use login control in asp.net C#. The below is I create the main page myself. In vb,I am ok with it but C# not good.
Anyone can help and any recommended website for asp.net C#?
The bottom is my source code where I have tried to use SQLdataReader:
aspx
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Main" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Navigation" Runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Footer" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" runat="server"
contentplaceholderid="RightTopContent">
<asp:Image ID="Image1" runat="server" Height="26px" Width="162px" />
<br />
Username :<asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>
<br />
Password :<asp:TextBox ID="txtPassword" runat="server"></asp:TextBox>
<br />
<asp:Button ID="btnSubmit" runat="server" onclick="btnSubmit_Click"
Text="Login" />
<br />
</asp:Content>
<asp:Content ID="Content6" runat="server"
contentplaceholderid="RightMiddleContent">
</asp:Content>
<asp:Content ID="Content7" runat="server" contentplaceholderid="MainContent">
</asp:Content>
aspx.cs
protected void btnSubmit_Click(object sender, EventArgs e)
{
string uname = txtUserName.Text;
string pwd = txtPassword.Text;
string connectionString = "Data Source= .\\SQLEXPRESS;"
+ "AttachDbFilename=\"C:\\Documents and Settings\\kathy\\My Documents\\Visual Studio 2008\\WebSites\\WebSite1\\App_Data\\salon.mdf\";"
+ "Integrated Security=True;"
+ "User Instance=True";
SqlConnection myConnection = new SqlConnection(connectionString);
SqlCommand cmd = myConnection.CreateCommand();
cmd.CommandText = "SELECT * FROM [Customer]";
myConnection.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
if (dr.GetOrdinal("UserName").ToString() == txtUserName.Text)
{
Response.Write("Heelo");
//dr.Close();
}
//dr.Close();
myConnection.Close();
}
|
|
|
|
|
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.
|
|
|
|