|
Hi,
Yes u can follow below step to full fill yr requirement.
1.Take the Hidden Field Control on your main Window.
2. Assign the ID to hidden field control from yr pop pup window like below:
window.opener.document.all["ctl00_cnPlaceHolder_hdnFieldId"].value=selectedIDValue;
The above code in Java script.
3. Call the "hdnFieldId" field Value Changed event.
protected void hdnFieldId_ValueChanged(object sender, EventArgs e)
While call the above event you can do wht ever u want.
There can be alternate solution, id dont like this one then let me know.
Feel free to ask any query
Regards
Anil Pal
|
|
|
|
|
Anil thanks ....Could you please provide me other solution?
|
|
|
|
|
I have few Web forms with same controls but different data. Which design pattern is suitable in this scenario?
WebForm 1 (city.aspx) with combobox and grid control
WebForm 2 (state.aspx) with same controls i.e, combobox and grid
WebForm 3 (country.aspx) with same controls i.e, combobox and grid
the structure of 3 Web forms is similar only the content is different at run time.
Instead of 3 .aspx & .cs files i want to refactor and apply design pattern which would suite this scenario. Which design pattern to apply to refactor the code?
|
|
|
|
|
They have design patterns for grouping controls in web forms now ? I'd imagine if you have pages with the same controls, you could make it one page and change the data sources based on a query string parameter. Or you can create a control that you can set data sources for, and consume that in three pages. But, it's just two simple controls, I don't think it's worth it.
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,
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.
|
|
|
|