|
hi,
i have next and previous buttons, when i click next i must get the next xml node value and if i click previous button it should display the previous node value. can anybody help in this regard.
Thanks in advance.
|
|
|
|
|
|
hi, thanks for the help.
Actually i have a webpage which contains previous and next buttons.
in the same page i have a frame where i have to change the value of the iframe src depending on the previous and next buttons. the value will be taken from XML node values.
Please check the xml doc below.
<?xml version="1.0" encoding="utf-8" ?>
<portfolio>
<portfolios id="0808">
<src link="http://www.yahoo.com"></src>
</portfolios>
<portfolios id="0809">
<src link="http://www.gmail.com"></src>
</portfolios>
<portfolios id="0810">
<src link="http://www.codeproject.com></src>
</portfolios>
<portfolios id="0811">
<src link="http://www.xyz.com"></src>
</portfolios>
</portfolio>
and check my backend coding.
protected void imgbtnNext_Click(object sender, ImageClickEventArgs e)
{
//string crnturl = Request.Url.ToString();
XmlDocument doc=new XmlDocument();
XmlNode root = doc.LastChild;
if (root)
{
imgbtnNext.Enabled = false;
}
else
{
string myurl = Request.QueryString.Get("id").ToString();
XmlDataSource xsd = new XmlDataSource();
xsd.DataFile = "~/App_Data/portfolio.xml";
xsd.XPath = "portfolio/portfolios[@id='" + myurl + "']/src";
GridView ds = new GridView();
ds.DataSource = xsd;
ds.DataBind();
iframeprojects.Attributes.Add("src", ds.Rows[0].Cells[0].Text.ToString());
}
}
|
|
|
|
|
Hmmm, seems a bit complicated. Why not loading the document and the use Xpath?
XmlDocument doc = new XmlDocument();
doc.Load("...");
XmlNode oCurNode = doc.SelectSingleNodes("portfolio/portfolios[@id='" + myurl + "']/src");
iframeprojects.Attributes.Add("src", oCurNode.Attributes["link"].InnerText);
Best would be to pass the id of the current node, so that you can find the next one.
Regards
Sebastian
|
|
|
|
|
hi thanks Sebastian,
Nut i didn't get how to get the next node value.
|
|
|
|
|
Extend the code as following to get the next node id:
XmlDocument doc = new XmlDocument();
doc.Load("...");
XmlNode oCurNode = doc.SelectSingleNodes("portfolio/portfolios[@id='" + id + "']/src");
iframeprojects.Attributes.Add("src", oCurNode.Attributes["link"].InnerText);
XmlNode oNextNode = oCurNode.NextSibling;
string sNextId = oNextNode.Attributes["id"].InnerText;
Then save the sNextId somewhere so that on the next button click you can use it.
Regards
Sebastian
|
|
|
|
|
I have Web application. In most of the forms Frames are used. We are planning to use Master pages instead of frames. Could you please let me know what are the advantages of using Master pages over frames?
|
|
|
|
|
Frames are not supported by some of the browsers, or users are allowed to turn it off.
|
|
|
|
|
Well, for a start, they are totally different from each other. TOTALLY different.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
I have Grid view control and this control is associated with SqlDataSource. Is it advicable to always associate a control with data source. What are the disadvantages doing so?
I'm currently changing the design and implementing MVC pattern.
Thanks in advance
|
|
|
|
|
nilam2477 wrote: Is it advicable to always associate a control with data source
You mean associating controls like SqlDataSource ? I don't recommend using SqlDataSource . It will force you to write SQL along with the markup. You will not get clean separation.
|
|
|
|
|
Hi, i created a first application using Ajax. I create a toolbar tab and get script manager control in the Master page. And then i used Ajaxcalendarextender in the design. But if i write code in the source it shows the following error.
<atk:calendarextender id="calImg" popupbuttonid="ImageButton1" targetcontrolid="TextBox1" runat="server" mode="hold" xmlns:atk="#unknown">
Unrecognized tag prefix or device filter 'ATK'.
Can anyone correct it?
|
|
|
|
|
What does the error message tell you ? Where do you define the atk namespace ? do you have any idea what you're doing ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
I have a ASP.net Web application. I have master pages. I have 5 web forms with same controls. At run time based on user selection each form is loaded.
I have one Web form (city.aspx) with combobox and grid control
i have 5 other web forms (state.aspx,etc) with same controls i.e, combobox and grid control.
When the user selects City, city.aspx form is loaded. similarly when user selects State, state.aspx form is loaded.
I want to refactor code. Instead of 5 seperate .aspx and .cs files i want to refactor. As the structure is similar and only during run time the web page is populated with different data. Which design pattern i can apply to refactor my code? Your help is appreciated. thanks in advance
|
|
|
|
|
Please don't ask the same thing over and over, it's rude.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Hi to all,
I am stucked in a problem and searched a lot.
But I am unable to resolve the issue.Please help me out.
Actually i have datalist in which there is column of "stock_on_hand".In the database table the value is "20". I want that if the stock in the database table is greater than "0" then in the datalist column it should show the text "In Stock". For this I did like this:
protected void Page_Load(object sender, EventArgs e)
{
try
{
string snam = Session["na"].ToString();
chi_id = Convert.ToInt32(Request.QueryString["c_id"]);
get_names();
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["newcon"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "select product_id, image,price,sh_desc,case when stock_on_hand >0 then 'In Stock' else convert(nvarchar, stock_on_hand) end from " + snam + " where child_id=@child_id";
cmd.Parameters.Add("@child_id", SqlDbType.Int).Value = chi_id;
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
con.Open();
sda.Fill(dt);
DataView dview = dt.DefaultView;
DataList1.DataSource = dview;
DataList1.DataBind();
con.Close();
}
catch(SqlException se)
{
ErrHandler.WriteError(se.Message);
}
catch(Exception ee)
{
ErrHandler.WriteError(ee.Message);
}
}
But it is giving an error:
DataBinding: 'System.Data.DataRowView' does not contain a property with the name "stock_on_hand" .
I am unable to solve the issue.Please assist me.
cheers,
sneha
|
|
|
|
|
You need to add the alias name for that column as stock_on_hand .
select
product_id, image,price,sh_desc,
case
when stock_on_hand > 0 then 'In Stock'
else convert(nvarchar, stock_on_hand)
end AS stock_on_hand
from " + snam + " where child_id=@child_id OT : Are you aware of using statement in C#? Heard about dispose pattern? SqlConnection , SqlCommand , SqlDataAdapter and DataTable got a Dispose() method and you haven't called it. If dispose method is provided, it is a good practice to call it when you finish dealing with the object.
|
|
|
|
|
N a v a n e e t h wrote: You need to add the alias name for that column as stock_on_hand.
Hi,
Thanks for your generous help.I am sorry I missed it. Now it is working fine.
N a v a n e e t h wrote: OT : Are you aware of using statement in C#? Heard about dispose pattern? SqlConnection, SqlCommand, SqlDataAdapter and DataTable got a Dispose() method and you haven't called it. If dispose method is provided, it is a good practice to call it when you finish dealing with the object.
Now I will remember to use the dispose() after the work with the objects is completed. Thanks for youe suggestion. I will always keep in mind.
cheers,
sneha
|
|
|
|
|
I am working on an application to post the data from my database to a particular website. For that after loging in im taking the URL of the website and adding on the values in the form of query string. But instead of going to the same page it navigates to the login page. Please suggest me how to handle that issue.
Thanks in advance,
aravind sarma
|
|
|
|
|
What on earth does this have to do with the sessions ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
pamsbeach wrote: But instead of going to the same page it navigates to the login page
Navigates to the login page of the other website? Other website created by you? There will be some user authentication happening on the page load of that web page and when it fails it might be redirecting to login page.
Hard to tell more without knowing the exact scenario.
|
|
|
|
|
Hello...
I am running my web based project from Windows Vista and i got this error. Same project is working perfectly in Windows XP service pack 2.
Logon failed. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for SQL Server Description: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. SQL State: 08001 Native Error: Error in File C:\Users\ADMINI~1\AppData\Local\Temp\crtFirstAidDetail {1D6C4EFB-F0DB-4AA1-A2EC-441EED35ECF5}.rpt: Unable to connect: incorrect log on parameters.
Please Advice.
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
i use a t_session table to restrict the user to log in my site through only one browser, means the same user can't log in the site using two browsers at the same time and it works fine, but if the use didn't log off properly then he can't log in to the web till the session expires,at the session_end event t_session table is cleared.
what i want is to clear the table when the user closes the window with out log off properly
any idea how to do this
|
|
|
|
|
There is no reliable way to do this. An AJAX call to log off when the browser is closed will work for much of the time, but you should never write such a system and not add a timeout, so that if the user turns off their browser without logging off, they are only locked out until that timeout expires. You would then update that timeout every time they access a page on the site.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Some pages getting this error.Plz help!
<br />
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.<br />
<br />
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.<br />
<br />
Source Error:<br />
<br />
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.<br />
<br />
|
|
|
|