How To Pass Values Between ASCX
Feb 14, 2010How to pass values between ASCX ?/
View 1 RepliesHow to pass values between ASCX ?/
View 1 Replieshow to pass values from ascx page contains [ 3 textboxes] to controller
View 2 Repliesin one ascx page i'm using gridview.from that i'm selecting a cell value as follows
foreach (GridViewRow gvr in grdOrganization.Rows)
I have a Menus user control and depending on which menu item the User clicks, the appropriate page is loaded by setting the hyperlink.NavigateUrl to the appropriate aspx page.I need to use the same page for 2 different menu items but I need to pass a value to the page so I know which data to load into it.Is there a way to pass the menu name or any other value from the usercontrol to the asp.net page?
View 12 RepliesI have created a UserControl [uscAuditTeam.ascx], there I have a Dictionary list and I added some values.
I want to pass the dictionary value to AuditTracking.aspx page. But it shows the null value.
[Code]....
From an ascx page, I click a link that opens a popup aspx page(child). That aspx page has a gridview with hyperklinks. When I click on one of the hyperlinks of my gridview, I want to pass the value in that cell to a textbox located on my ascx page(parent). I try using javascript , but I can't get it to work. here is my javascript code and the gridview code:
<script language="javascript" type="text/javascript">
function post_value(str) {
window.opener.document.getElementById('textbox1').value = str;
self.close();
}
</script>
[Code]....!
I have two files in my project. One is user control (popup) customerpicker.ascx and one is default.aspx page. In customerpicker I have dynamically generated gridview and 'select' column with SelectButton.
What I want is this: When I click on 'select' on random row in gridview, then I like to display value from selected row immediately (like ajax) to aspx.page. How it is possible?
There is part of my code in .ascx:
public string showOnaspx { get; set; }
protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
GridViewRow row = GridView1.Rows[e.NewSelectedIndex];
showOnaspx = row.Cells[1].Text;
e.Cancel = true;
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = GridView1.SelectedRow;
//row[i].Attributes.Add("onclick", "$('#ContentIndex_sometextbox).val(" + row[i].Cells[1].Text// + "); $('#Close').click();");
}
I also tried with jqeury (comment in selectedindexchanged function), but it does not work well, because user have to click SELECT two times to effect.
I'm developing an ASP.NET application with C# and Ajax.I have a page that holds user controls loaded dynamically. I need to pass some data (integer values and some strings) to the user control that has been loaded dynamically.Now I use Session to pass these values, but I think I can use another way; something like VIEWSTATE or hidden input.What do you recommend me?The fact that I load the controls dynamically is important because controls are loaded on every postback, and I can't store any value on controls.
View 9 Replieshow to use gridview usercontrol (Ascx) and sql pass to aspx page
View 4 RepliesI have to build a few ascx partial views in my MVC applications to encapsulate re-usable functionalities as well as archive SOR and SOC. However, I encountered challenge how to encapsulate the business logic that drives MVC ascx views.In webforms, the code behind of an ASCX control can handle a button click event and browser still shows the same page with only one postback. How can I archive the same thing in MVC? When ~/Address/Edit/2 includes an ascx partial view with a button on it that calls another MVC action - let's say ~/ShareController/CommonAction - what is the best way for the CmmonAction to return to the very same view that includes the ascx file?Perhaps I am missing a common pattern in MVC web development?
View 5 RepliesI am having difficulties how to construct my question, but if I have to put it simply the situation is that I have categories of products. I have an aspx with a repeater on the left that lists the categories. And I want the products to be listed on the right. Category number is variable so I made an ascx with a DataList in it. When I try to do foreach category, ascx = new ascx(); then the DataList within this ascx control is null.
ps: what I want to do is to preload all the products (thre is not much) and hide the divs and fadein fadeout them using jQuery when a category div is clicked.
rightnow it is using jQuery.load(); and I don't like how the images load, cuz they download from top to bottom. Progressive gifs alsdo not an option. site demo is here [URL]
I am not sure how to pass a variable from an .aspx page to an .ascx page. I have a Control that puts rotating banners on a page. The control has several public properties. However, only one of those properties changes on the page level. All the other properties are the same for every page site-wide. So, instead of setting all the properties on every page in my sites (many sites), I want to set it up so I only have to setup the sitewide properties once and only the page level properties on each page.
I want to create a control with a property of AdKeyword="somename" and pass it to another control that will grab that page-level property and add it to all the other site-wide properties. I guess what I need could be called a Dynamic Control Property.
My .aspx page has:
[Code]....
[Code]....
Now, how do I pass the "OverrideHeight" parameter to the "uc1:banner" control on the banner1.ascx page?
I tried binding the parameter with a
[Code]....
string in the control. But, that did not work.
I'm developing second language support for the site. So I made duplicate .ascx and .aspx files for existing ascx.cs and aspx.cs
Most of the time everything works fine.. but suddenly I'm getting:
Type 'ctrl_car' exists both in 'c:WindowsMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Files
zhdengined072cc729d5698bApp_Web_xdmblegv.dll', and in 'c:WindowsMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Files
zhdengined072cc729d5698bApp_Web_gkptrzo2.dll' (translated from russian)
ctrl_car ctrl = (ctrl_car) LoadControl("car.ascx");
I have few such strings of code... and same error occurs with one of them. But WITHOUT any changes from me with those files. To fix thaat bug for some time I need to delete solution and website folder and reget them from SS. Solution was converted from vs2005.
i have one scenario in which i have to pass values from one page to another for that currently i am using querystring but now the values are more so i want to remove querystring and i dont want to user session as well and so i have tried using Hiddenfields but after redirecting to another page the values are cleared from all the hidden fields.
View 14 RepliesI would like to discuse with u, now i have one problem, ie, how could i pass value from the code behind to the web service, in that ,i have to pass 3 values,1, context key2, prefix text3, dropdown selected text or value, ( Contains Designation Details)how could i pass this 3rd value
View 1 RepliesWhy can I not call the global variables CatCode and CompanyName which are equated in the first procedure GetCompanyCatID And use their new values in the second procedure UpdateCompanyCounts as parameter values. When I hard code them code their values at the end of the GetCompany CatID procedure the following procedure updates properly.
string CatCode; - delcared global
string CompanyName; - delcared global
protected void GetCompanyCatID()
{
LinkID2 = Request.QueryString["linkid"].ToString();
string L_ID = LinkID2;
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString001"].ConnectionString);
SqlCommand cmd = new SqlCommand("GetCID", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@L_ID", L_ID);
try
{
con.Open();
using (SqlDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
if (reader["CG_ID"] != System.DBNull.Value)
CatCode = (string)reader["CG_ID"];
CompanyName = (string)reader["CG_Name"];
}
}
}
catch (SqlException exc)
{ }
finally
{ con.Close(); }
// ******* HARD CODED to test below update procedure, it works. When commented out the following update procedure does not update.
CatCode = "55555"
CompanyName = "Test";
UpdateCompanyCounts();
}
protected void UpdateCompanyCounts()
{
LinkID2 = Request.QueryString["linkid"].ToString();
string L_ID = LinkID2;
string CatCode2 = CatCode;
string CompanyName2 = CompanyName;
// string CatCode2 = "23456";
// string CompanyName2 = "TEST";
SqlConnection con2 = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString001"].ConnectionString);
SqlCommand cmd2 = new SqlCommand("UpdateCatCounter", con2);
cmd2.CommandType = CommandType.StoredProcedure;
cmd2.Parameters.AddWithValue("@L_ID", LinkID2);
cmd2.Parameters.AddWithValue("@CG_ID", CatCode2 );
cmd2.Parameters.AddWithValue("@CG_Name", CompanyName2 );
try
{
con2.Open();
cmd2.ExecuteNonQuery();
}
catch (SqlException exc)
{
// ErrorBox.Text += string.Format("Error: {0}<br/>", exc.Message);
}
finally
{
con2.Close();
}
}
i am trying here is to pass values to other pages. When i include the following code
private void Button1_Click(object sender, System.EventArgs e)
{
Response.Redirect("WebForm5.aspx?Name="+txtName.Text);
[code]...
Basically I want to display a popup box only at a specific time in asp.net application. so i'm using the following
[code]....
but this code is not working. the alert box is not popping up. is this a correct method to pass values to the script?. or what else to be done to meet the requirement?.
I guarantee the title of my thread does not explain what I am looking for, but I just can't think of a better way to word it. What I have right now is an application that the user can add, search, and update various orders in the System. I've been working on the front end page, and wanted to display a summary of all orders performed this month. Right now the Orders are represented as labels (based on data pulled from the database). What i'd like to do is replace these labels with hyperlinks. I was hoping that by doing that I could somehow write some code so that when an order is clicked that the user is taken directly to the search page and that order is displayed.
View 6 RepliesNow that i learned how to pass values to an SWF object via flashvars, how can i pass values from a querystring to javascript?
What do i mean? In the following example i hard-code the xml file to load in the SWF object.
<script type="text/javascript">
var so = new SWFObject("preview.swf", "", "100%", "100%", "9", "#ffffff");
so.addParam("allowFullScreen", "true");
so.addParam("scale", "noscale");
so.addParam("menu", "false");
so.addVariable("xmlPath", "xml/exampleData.xml");
so.write("flashcontent");
</script>
Since the Xml file is created dynamic, the xml should be loaded from the value of a query-string. (I guess).
Supposing my url is http://www.example.com/load.aspx?XmlFile=SomeData
How can i pass it to the javascript side? Like..
so.addVariable("xmlPath", "xml/<% SomeData %>.xml");
or whatever it needs to make it work.
UPDATE: Besides the above example, is there any way of creating the JavaScript, in server-side?
I want to pass the data from asp.net to silverlight.I tried for jquery to pass data from asp.net to silverlight.but it not working.
View 2 RepliesAt the moment I pass values from one page to another. I need to pass objects between pages, how can I do this.
View 3 RepliesI am trying to implement the autocomplete method for textboxes.
I would like to use the example based on jquerys autocomplete provided here
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script>
$(document).ready(function() {
$("input#autocomplete").autocomplete({
source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
});
});
</script>
</head>
The first and Main problem is that i do not know the way of passing my values to the source:
By saying that i mean, supposing i have a a server-side ASP.NET function GetTheResults as listof(string) or GetTheResults as string ()
how am i supposed to pass those values as source required by the auto-complete?
The second problem is that the specific way does not use AJAX.
Which means i guess on the load of the form i will load all the available values to the source. Isn't that an overkill?
I would like to know the method of passing session variables/values to a subdomain from the main website.For eg : Upon user login, I would like to set some session variables and redirect the page to a subdomain URL.
How can this be done? fyi... I have setup two websites in IIS. One is localhost and the other is subdomain.localhost
So, If I want to retrieve the session values in subdomain.localhost (which points to a specific folder in the app), how should I go about it?
I enabled the selection on my gridview. The question is, I can pass values with buttons but it seems redundant, because I have selection linkbuttons. So how can I pass variables with them ?
View 1 Replies