|
Read this link
http://www.dotnetspider.com/qa/Question13.aspx
It may be helpful 4 you...
Girish Kumar Sharma
|
|
|
|
|
Hi.. Friends !!
I want to refresh my user control after clicking
on button...
Means, I have a shopping cart page, and when I click on 'Add to Cart' button from GridView, I want to reload my 'CartListing' user control on the same page...
Because, When I click on 'add to cart' button, It simply postback the current page, And I can not see the last added product in cart listing user control !!
So, I have to dynamically refresh my 'CartListing' user control...
And I dont know to to refresh it after clickin on button...
So, If you have any idea regarding it, please given me ASAP
Thanks in advance !!
Bye..
Take care.
Regards,
Abhi
|
|
|
|
|
-- Abhi -- wrote: Because, When I click on 'add to cart' button, It simply postback the current page, And I can not see the last added product in cart listing user control !!
This won't be a problem of user control reloading. Web user controls ( ascx files ) are replacement for classical ASP include files. When page posts back, your user control also reloads. If it is not showing the newly added items, that may be some other reason. How you are maintaining the cart ? Is your user control having any cache option set ?
|
|
|
|
|
Thanks so much from your reply post...
But, the thing is that..
I got solution by other way...
Thanks a lot !!
Take care..
Bye.
Regards,
Abhi
|
|
|
|
|
-- Abhi -- wrote: I got solution by other way...
That's great. Would you mind sharing it here ?
|
|
|
|
|
Yes. Sure.
See, I have a 'CartList' user control.
Now, this 'CartList' control contais a 'private void BindCart()' methods that binds the current product items to the grid view those are purchased by client.
Now, In my 'ProductListing.aspx' I have to refresh this User Control my 'Add to Cart' button click.
Now, What i have done is :
1. I have made 'private void BindCart()' methods to 'public void BindCart()'. So, I have made public methods in my UserControl.
2. I have first of all inserted all product to the 'tblCart' those are purchased by client.
3. Then, I called this Methods on 'Add to Cart' button click event.
Ex. ProductCart1.BindGrid();
4. So, Now I've a refreshed product cart on my same page.
That's it.
Thanks for this conversation.
Regards,
Abhi
|
|
|
|
|
Hi ,
I am trying to databind a list box to a strongly typed datatable
On execution the list box is listing
System.Data.DataRowView
for all the elements of the datatable
can anyone please let me know on this,
Thank you ,
With Warm Regards,
Nikhil Pagidala
Happy Programming!
Regards,
Nikhil Pagidala
|
|
|
|
|
Nikhil Pagidala wrote: I am trying to databind a list box to a strongly typed datatable
try to do the other way. Bind the strongly-Typed DataTable to the ListBox. and check whether the neccessary columns (ID and Value) are Defined in the DataTable...
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|
|
My following code is not working
I have a gridview that contains a linkButton in a template field. I
want to set the visibility of the linkbutton based on a int field in a
database.
Selecting the proper field in editbindings gives this in the code
<asp:linkbutton id="btnRemoveAll" runat="server"
visible="<%#(int.parse(Eval("UserCnt")!=0)) %>" onclick="btnRemoveAll_Click">Remove All
(where UserCnt is int field in my database)
This generates the following error.
'int' does not contain a definition for 'parse'
seema
|
|
|
|
|
Visible='<%#(Int.Tryparse(Eval("UserCnt")))%>'
Int.TryParse returns bool
Best Regard Pathan
|
|
|
|
|
Hi:
I have a dts that takes the data from a file (which is on a folder of a server) and loads it in my local database tables. My dts package is configured with windows authentication and i am accesing the dts package using the following code: oPKG.LoadFromSQLServer("SERVER", "", "", DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrustedConnection, , , , "DTSPackage").
When running it i received this error:
"Failure creating file."
Do u know what could be happening? Any ideas?
NOTE:
If i run the dts package through the Enterprise Manager, it works fine. Import the data,etc...
THANKS!!!
JOHN
|
|
|
|
|
I had an .msi file in ASP.NET for a Web report project. Recently I've modified it. How do I recreate that modified file? Please help.
|
|
|
|
|
I would prefer to have hyper link not to redirect, but it goes to previous page.
Thanks in Advance
|
|
|
|
|
I prefer cold beer and blonde women. Is there a question you'd like to ask?
If you don't want a hyperlink to redirect, then remove it!
Sorry couldn't resist!
|
|
|
|
|
I want to have hyperlink, but that doesn't redirect, but would function like as back button on browser
|
|
|
|
|
<a href="javascript:history.go(-1)">Go Back</a>
|
|
|
|
|
|
<a href="javascript:history.back()">Go To Previous Page</a>
Regards
John
|
|
|
|
|
|
Hello All,.
I am facing a Problem Here.
I Have been trying to do this since 2 days.
Note : I am working on ASP.NET with C# as code behind
Assume that I have a the Following Database Tables from Northwind DataBase
1) Products
2) category
The Category table Contains Category ID and categoryName
The Products Table Contains ProductName , categoryID
I have a GridView whose data source is the ProductTable
I have a DropDownList whose data Source is the Category Table
and the dropdownlist Should only display the Category Name
Based on the Selected Category Name from the drop down list, the products Table should display on the GridView control which I added on the aspx page earlier
But the twist here is
In order to get the ProductNames from the Products Table , I have to pass the CategoryID only to the method that has the SQL Query.. GetProductsBycategoryID()
But I am only displaying the Category Names on the Drop Down List
How can I Relate the Names to their corresponding IDs and then pass the category ID to the GetProductsbycategoryID() function..
Please let me know on this.
This is the code I am trying to work on...
It is very dissorganised as I am trying different things
If this sample works for me , I can include this functionality in my project,.
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
using NorthwindTableAdapters;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ProductsTableAdapter productsAdapter = new ProductsTableAdapter();
CategoriesTableAdapter categoryAdapter = new CategoriesTableAdapter();
// ddl_Category.DataSource = categoryAdapter.GetCategories();
//ddl_Category.DataTextField = "CategoryName";
//ddl_Category.DataValueField = "CategoryID";
//ddl_Category.DataBind();
GridView1.DataSource = productsAdapter.GetProducts();
GridView1.DataBind();
ddl_Category.Items.Insert(0,"PleaseSelectACategory");
ddl_Category.Items.Insert(1, "Some1");
ddl_Category.Items.Insert(2, "Some2");
ddl_Category.Items.Insert(3, "Som3");
ddl_Category.Items.Insert(0, "PleaseSelectACategory");
ddl_Category.SelectedIndex = 0;
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void ddl_Category_SelectedIndexChanged(object sender, EventArgs e)
{
////ProductsTableAdapter productsAdapter = new ProductsTableAdapter();
//////int catID = ddl_Category.SelectedIndex;
////string somesome = ddl_Category.SelectedValue.ToString();
////int catID2 = Int32.Parse(somesome);
////GridView1.DataSource = productsAdapter.GetProductsByCategoryID(catID2);
////GridView1.DataBind();
}
protected void ddl_Category_SelectedTextChanged(object sender, EventArgs e)
{
}
}
Thanks a lot,
Nikhil Pagidala
Happy Programming!
Regards,
Nikhil Pagidala
|
|
|
|
|
Nikhil Pagidala wrote: The Category table Contains Category ID and categoryName
Nikhil Pagidala wrote: ddl_Category.Items.Insert(0,"PleaseSelectACategory");
ddl_Category.Items.Insert(1, "Some1");
ddl_Category.Items.Insert(2, "Some2");
ddl_Category.Items.Insert(3, "Som3");
ddl_Category.Items.Insert(0, "PleaseSelectACategory");
ddl_Category.SelectedIndex = 0;
Didn't you write a method that will fetch the data from the category table and bind to the dropdownlist. something like.... GetAllCategory()
Nikhil Pagidala wrote: ddl_Category.SelectedIndex = 0;
you don't have to explicitly write a line to set the SelectedIndex property of DropDownList to Zero(0). it set's it by Default.
Nikhil Pagidala wrote: How can I Relate the Names to their corresponding IDs and then pass the category ID to the GetProductsbycategoryID() function..
set the AutopostBack property of the dropdown list to True
Fetch the Data from the Category table and Bind the CategoryID and CategoryName feild to the DataValueField and DataTextField property of the DropDownList control. try something like this....
DataSet LocalDataSet = new DataSet(); <br />
LocalDataSet = MobjDAL.GetALLCategory(); <br />
ddlCategory.DataValueField = "CategoryID"; <br />
ddlCategory.DataTextField = "CategoryName"; <br />
ddlCategory.DataSource = LocalDataSet; <br />
ddlCategory.DataBind();
then in the selectedIndexChanged Event of the DropDownList try something like this to show the related Data in the GridView...
DataSet LocalDataSet = new DataSet();<br />
LocalDataSet =productsAdapter.GetProductsByCategoryID(ddlCategory.SelectedValue);<br />
GridView1.DataSource = LocalDataSet; <br />
GridView1.DataBind();
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|
|
|
GridView is only control that displays data.
Datasource connect to your SQL Server. When you Bind datasource to a GridView, You will connect GridView to database. If you don't use Datasource, you would need to write a code to read from database to GridView. I am doing a certan project, that require more control, so i am doing it manualy.
|
|
|
|
|
ss.mmm wrote: why to use datasource to gridview?Can you please explain?
To tell the GirdView what Data to dsiplay and From where(Source) the Data has to be fetched."
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|
|
Which is the best way to store a dataset over a page?
Session, Cache or Viewstate?
Thanks
|
|
|
|