|
Hi,
Thanks
Could u please tell me how to use singleton,where to implement.
Thanks in advance
|
|
|
|
|
I did not tell you to use a Singleton, I told you not to reference the session statically.
I did also ask you to post some code demonstrating how you read/write to the session to enable me to answer your query more accurately.
|
|
|
|
|
|
Hi all
I am trying to find Window key event inside Iframe
Can any one give me idea how to find window event inside iframe
window.frames.event
This will return null in java script
How to get Event....Help me please
Thanks
|
|
|
|
|
hi, i have a page on asp.net, i'm trying to run it on browser but i gives me error cannot find server, what should i do?by the way , the PC i'm working on is in local network
|
|
|
|
|
Hi lost_in_code,
Sounds like IIS in not configured to run your asp.net application.
Please can you give more details. e.g. Operating System / IIS or Apache etc...
Regards
Julian Mummery
Please Visit my FREE Bug / Fault Logging Website at FaultLogger.com
|
|
|
|
|
hi,i dont think the problem is from IIS 'cause i tried to open it on my PC and it worked(i run it from .net) and i dont have IIS, but when i try run it from a PC on local network it dosnt work and give the following error:
The requested URL could not be retrieved
While trying to retrieve the URL: http://localhost:3274/trywebsite/Default.aspx
The following error was encountered:
Unable to determine IP address from host name for unknown server name
This means that:
The cache was not able to resolve the hostname presented in the URL.
Check if the address is correct.
but i entered the right address, i dont know the problem!!!!
|
|
|
|
|
Hi,
You cannot use it like that.
Example
PC No.1 is running the .NET application through Visual Studio by accessing -> http://localhost:3274/trywebsite/Default.aspx
PC No.2 which is on same Local Area Network tries to access the same address. This will not work as localhost refers to PC No.2 itself and of course the application is running on PC No.1
The following is untested but may work:-
1. Find out the local IP Address of PC No.1 by going START >> Run and typing CMD [enter]
2. type IPCONFIG [enter] and note down your Ethernet Adapters IP Address (usually ner the top) it
will be something like 192.168.x.x (mine is 192.168.2.38 for example)
3. Go to PC No.2 and try to access it in browser by typing in (where the .x.x is your local ip address) ->
http://192.168.x.x:3274/trywebsite/Default.aspx
Failing that you will have to set it up as an applciation in IIS and then you will be able to access it without the port number e.g. http://192.168.x.x/trywebsite/Default.aspx
I hope this helps. Please let me know how you get on.
Regards
Julian Mummery
Please Visit my FREE Bug / Fault Logging Website at FaultLogger.com
|
|
|
|
|
HI!
I do not know how to populate my GridView with stored procedure I have this code but it doesn't works she returned result or error message
public void BindData()
{
SqlConnection myConnection = new SqlConnection(ConnectionString);
SqlCommand myCommand = new SqlCommand("PS_NV2", myConnection);
myCommand.CommandType = CommandType.StoredProcedure;
SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand);
DataSet ds = new DataSet();
myAdapter.Fill(ds, "TAble");
myConnection.Open();
myCommand.ExecuteNonQuery();
GridView2.DataSource = ds;
try
{
GridView2.DataBind();
}
catch
{
GridView2.PageIndex = -1;
GridView2.DataBind();
}
myConnection.Close();
correct me please.Thanks
|
|
|
|
|
execute the executenonquery before putting into adapter.
|
|
|
|
|
Thank you Satish Mahapatra.
it doesn't works
this code works fine for a datagrid but not for the GridView
I do not know if the error can come from here
for datagrid i have DataGrid1.CurrentPageIndex = 0;
I have replaced by : GridView2.PageIndex =0 ;
thanks.
|
|
|
|
|
can u send me whole code and where exactly ur getting the error with error description.
|
|
|
|
|
I have no erreur no message erreur if i click sur the button I havent result.
my code c#:
using System;<br />
using System.Data;<br />
using System.Configuration;<br />
using System.Collections;<br />
using System.Web;<br />
using System.Web.Security;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using System.Web.UI.HtmlControls;<br />
using System.Data.SqlClient;<br />
<br />
private void Page_Load(object sender, System.EventArgs e)<br />
{<br />
}<br />
public void BindData()<br />
{<br />
SqlConnection myConnection = new SqlConnection(ConnectionString);<br />
SqlCommand myCommand = new SqlCommand("PS_NV2", myConnection);<br />
myCommand.CommandType = CommandType.StoredProcedure;<br />
SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand);<br />
DataSet ds = new DataSet();<br />
myAdapter.Fill(ds, "table");<br />
myConnection.Open();<br />
myCommand.ExecuteNonQuery();<br />
GridView2.DataSource = ds;<br />
try<br />
{<br />
GridView2.DataBind();<br />
}<br />
catch<br />
{<br />
GridView2.PageIndex = 0;<br />
GridView2.DataBind();<br />
}<br />
myConnection.Close();<br />
<br />
}<br />
private string ConnectionString<br />
{<br />
get<br />
{<br />
string connectionString = (@"Data Source=.\SQLEXPRESS;UID=sa;Password=**3*;Initial Catalog=mybd");<br />
<br />
return connectionString;<br />
}<br />
}<br />
protected void GridView2_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)<br />
{<br />
Response.Write(e.NewSelectedIndex); <br />
<br />
}<br />
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e)<br />
{<br />
GridViewRow row = GridView2.SelectedRow;<br />
<br />
TextBox4.Text = row.Cells[2].Text;<br />
<br />
}<br />
protected void GridView2_RowEditing(object sender, GridViewEditEventArgs e)<br />
{<br />
GridView2.EditIndex = e.NewEditIndex;<br />
BindData();<br />
}<br />
<br />
protected void GridView2_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)<br />
{<br />
GridView2.EditIndex = -1;<br />
BindData();<br />
}<br />
<br />
<br />
protected void Button1_Click1(object sender, EventArgs e)<br />
{<br />
BindData();<br />
GridView2.Visible = true;<br />
}<br />
}<br />
<asp:gridview id="GridView2" runat="server" allowpaging="True" autogeneratecolumns="False" xmlns:asp="#unknown"><br />
DataKeyNames="c1" OnRowCancelingEdit="GridView2_RowCancelingEdit"<br />
OnRowEditing="GridView2_RowEditing" OnSelectedIndexChanged="GridView2_SelectedIndexChanged"<br />
OnSelectedIndexChanging="GridView2_SelectedIndexChanging" Style="left: -214px;<br />
position: relative; top: 82px"><br />
<selectedrowstyle backcolor="Yellow" /><br />
<columns><br />
<asp:templatefield headertext="c1"><br />
<edititemtemplate><br />
<asp:textbox id="id0" runat="server" text="<%# Bind("c1") %>"></asp:textbox><br />
</edititemtemplate><br />
<itemtemplate><br />
<asp:label id="id01" runat="server" text="<%# Bind("c1") %>"></asp:label><br />
</itemtemplate><br />
</asp:templatefield><br />
<asp:templatefield headertext="c22"><br />
<edititemtemplate><br />
<asp:textbox id="id1" runat="server" text="<%# Bind("c2") %>"></asp:textbox><br />
</edititemtemplate><br />
<itemtemplate><br />
<asp:label id="id11" runat="server" text="<%# Bind("c2") %>"></asp:label><br />
</itemtemplate><br />
</asp:templatefield><br />
<asp:templatefield headertext="c33"><br />
<edititemtemplate><br />
<asp:textbox id="id2" runat="server" text="<%# Bind("c3") %>"></asp:textbox><br />
</edititemtemplate><br />
<itemtemplate><br />
<asp:label id="id21" runat="server" text="<%# Bind("c3") %>"></asp:label><br />
</itemtemplate><br />
</asp:templatefield><br />
<br />
<br />
<asp:commandfield showeditbutton="True" showselectbutton="True" /><br />
</columns><br />
</asp:gridview>
thanks
|
|
|
|
|
i told u to put that executenonquery statement before putting into adaptare.now u just debug the code and see in the binddata method what it returns in the dataset and tell me.
|
|
|
|
|
Thank you Satish Mahapatra it works I forgot a field in my stored procedure.
|
|
|
|
|
Dear sir/madam
I have designed a login page where a user can enter,user name and password.The program can compare the password from database and can verify.The program is ok for a single user.
But when we have multiple user then i got the problem.The problem is that how can we know the specific user have logged in by comparing the password with database.And after comparing the password,how can we generate the name of the user stored in database in a new page..
waiting for the reply..
|
|
|
|
|
You can add a column to your database telling you a user is currently logged in.
rosae619 wrote: how can we generate the name of the user stored in database in a new page..
Store it in the session.
I'd recommend buying a book on ASP.NET and web development.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
hi
thanx for the help..
here i am a bit new to ASP.NET,and i am trying to develop a web page in ASP.NET using c#.since i am new to this field,can you help me about the session(i am new to the session) and database stuffs..
waiting for the reply
|
|
|
|
|
Hi,
assign the user name which logged in to session like this,
session["username"]=txt_username.Text
|
|
|
|
|
I would recommend you buy a book on ASP.NET and read it. If you're doing paid work, stop it, and you should be ashamed. If you're teaching yourself, you should slow down and work through a book rather than try to do something that you could only do very badly given your obvious lack of experience. You need to learn how to do it first, even if your code works, I expect it's far from production quality at this point.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi, In my project i used a gridview. I fill the details using Databind() method. And i want to format some detail using Html coding of the Grid view. They r working.
But during Runtime, the Datas are displayed twice both from html coding and Databind() method. How to avoid this?
I want to display only from Html coding? Is there is any code to fetch datas from Html?
|
|
|
|
|
Your best bet nearly always is using databinding. You can use runat="server" to interact with html elements, but I doubt that's what you want to do.
Perhaps if you posted your code we could point out what's wrong with it.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
In C# i write this code for produce datas?
protected void lnkview_Click(object sender, EventArgs e)
{
view.Visible = true;
add.Visible = false;
try
{
con.Open();
com = new SqlCommand("select *from hotjob", con);
rd = com.ExecuteReader();
view1.DataSource = rd;
view1.DataBind();
con.Close();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
But i want some of the datas to appear in Link button. So i format it in the Html Coding.
<asp:gridview id="view1" runat="server" cellpadding="4" forecolor="#333333" gridlines="None" xmlns:asp="#unknown">
<footerstyle backcolor="#507CD1" font-bold="True" forecolor="White">
<rowstyle backcolor="#EFF3FB">
<editrowstyle backcolor="#2461BF">
<selectedrowstyle backcolor="#D1DDF1" font-bold="True" forecolor="#333333">
<pagerstyle backcolor="#2461BF" forecolor="White" horizontalalign="Center">
<headerstyle backcolor="#507CD1" font-bold="True" forecolor="White">
<alternatingrowstyle backcolor="White">
<columns> <asp:templatefield headertext="Job-ID" headerstyle-horizontalalign="Center">
<itemtemplate>
<asp:label id="lblId" runat="server" text="<%# Bind(" jid")="" %>"="">
<asp:templatefield headertext="Title" headerstyle-horizontalalign="Center">
<itemtemplate>
<asp:label id="lbltit" runat="server" text="<%# Bind(" title")="" %>"="">
<asp:templatefield headertext="Description" headerstyle-horizontalalign="Center">
<itemtemplate>
<asp:label id="lbldes" runat="server" text="<%# Bind(" description")="" %>"="">
<asp:templatefield headertext="Qualification" headerstyle-horizontalalign="Center">
<itemtemplate>
<asp:label id="lblqua" runat="server" text="<%# Bind(" qualification")="" %>"="">
<asp:templatefield headertext="Vacancies" headerstyle-horizontalalign="Center">
<itemtemplate>
<asp:label id="lblvac" runat="server" text="<%# Bind(" vac")="" %>"="">
<asp:templatefield headertext="Location" headerstyle-horizontalalign="Center">
<itemtemplate>
<asp:label id="lblloc" runat="server" text="<%# Bind(" location")="" %>"="">
<asp:templatefield headertext="Mail-ID" headerstyle-horizontalalign="Center">
<itemtemplate>
<asp:linkbutton id="lblmail" runat="server" text="<%# Bind(" mail")="" %>"="">
<asp:commandfield headertext="Delete" showdeletebutton="True" showheader="True">
This is the full code. It is working but datas display twice. I want to display only the Datas from Html.
|
|
|
|
|
Ah - add AutoGenerateColumns="false" to your grid view, by default it adds your templated columns AND generates one for each column in your data source.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi, thanks very much. Its working.
|
|
|
|