Help related to GridView using C# in asp.net 2.0
Hi all,
I am new to Web development. I have taken a project "Inventory Management" at my office. Now I am got stuck in GridView part. I have designed a Purchase Order Web Page, in this the user is required to feed in (lets say) Five items along with their rates based on the purchase order number and vendor name through which the items are going to be purchased.
Item description has been taken from ItemMaster table in dropdownlist control. The user is required to select an item from the dropdownlist and feed in their rates. This part is being done in gridview and is working.
What I have come to know while developing, u cannot view GridView at runtime unless atleast one column is databound with some table.
For that I have taken a temporary table which have only one field i.e. serial no. So when I click the button "AddNew" one row is added into the table thereby simultaneously incrementing one row of gridview. This is also happening whenever I click the Button.
This grid view has 4 columns - 1.S.No. [DataBound], 2.Item Code, 3.Item Descripttion, 4. Rate.
Though HTML Templates I have created
a TextBox for ItemCode, (2)
a DropDownList for Item Description (3)
a Text Box for Rate (4)
Now when I run the program it shows the gridview in proper formatted way :
Button => AddNew
-------------------------------------------------------------------
S.no. |Item Code | Item Description | Rate
------------(2)-------------(3)-----------------------------(4)----
1 TextBox DropDownList TextBox
-------------------------------------------------------------------
In first row a user can select item description, item code automatically comes based on the selected item and then feed in the rate accordinglly.
PROBLEM => But the moment "AddNew" button gets clicked whole data gets cleared including the first row. why this is happening. How can I solve this problem? Please HELP ?
-------------------------------------
Another way of entering the data what I thought is :
Step 1 : Dyanamically I create a textbox for itemcode,
dropdownlist for item description and textbox for rate.
Step 2 : Then count number of rows in a Grid.
Step 3 : If there is one row then these dynamically created
controls will be placed in the respective cols of grid.
This should happen <Step 3> whenever "AddButton" is clicked
Now the same problem how to do this.
Please help ?
|