|
You are right. I do instantiate objects for each column. That's why I thought that my code should work. Cloumn 5 is where I calculate the weights so I'm using the dgtemp object (Please see code below).
Thanks,
' Bind data to DataGrid
Dim dg As New DataGrid
dg.ID = "dg" & 1
dg.AutoGenerateColumns = False
' Cloumn 1
Dim tc1 As New TemplateColumn
tc1.HeaderTemplate = New DataGridTemplate(ListItemType.Header, "SKU", "", 0)
tc1.ItemTemplate = New DataGridTemplate(ListItemType.Item, "itm_sku", "", 1)
dg.Columns.Add(tc1)
' Cloumn 2
Dim tc2 As New TemplateColumn
tc2.HeaderTemplate = New DataGridTemplate(ListItemType.Header, "DESCRIPTION", "", 0)
tc2.ItemTemplate = New DataGridTemplate(ListItemType.Item, "itm_desc", "", 2)
dg.Columns.Add(tc2)
' Cloumn 3
Dim tc3 As New TemplateColumn
tc3.HeaderTemplate = New DataGridTemplate(ListItemType.Header, "QTY TO SHIP", "", 0)
tc3.ItemTemplate = New DataGridTemplate(ListItemType.Item, "itm_qty", "", 3)
dg.Columns.Add(tc3)
' Cloumn 4
Dim tc4 As New TemplateColumn
tc4.HeaderTemplate = New DataGridTemplate(ListItemType.Header, "QTY ORDERED", "", 0)
tc4.ItemTemplate = New DataGridTemplate(ListItemType.Item, "itm_qty", "", 4)
dg.Columns.Add(tc4)
' Cloumn 5
Dim tc5 As New TemplateColumn
tc5.HeaderTemplate = New DataGridTemplate(ListItemType.Header, "WEIGHTS (lbs)", "", 0)
Dim dgtemp As New DataGridTemplate(ListItemType.Item, "itm_qty", "itm_sku", 5)
tc5.ItemTemplate = dgtemp
dg.Columns.Add(tc5)
' Try to get grand total
txt_total_weight.Text = dgtemp.GetTotalWeight()
' Bind Reader (data from DB) to DataGrid
dg.DataSource = rdrItm
dg.DataBind()
|
|
|
|
|
Because you are using the DataBinding event to populate the grandtotalweight, so if you access this variable before the DataBind method is called (before the DataBinding event gets fired), the result is clearly 0. The quick fix is to move it after the DataBind method call:
'Try to get grand total
'txt_total_weight.Text = dgtemp.GetTotalWeight()
' Bind Reader (data from DB) to DataGrid
dg.DataSource = rdrItm
dg.DataBind()
'Try to get grand total
txt_total_weight.Text = dgtemp.GetTotalWeight()
|
|
|
|
|
Man...... Thank you very much.
Sometimes it takes a fresh eye to see these kind of 'stupid' mistakes.
Thanks.
|
|
|
|
|
I have three div elements: (divleft,divcenter,divright) in my page. There are links in the divleft created through ASP:HyperLink control. When any link is clicked i want to display the refered throug NavigateURL in the divcenter. What should i do for that?
Thanks
|
|
|
|
|
Try using an IFrame inside the div center and set the src property of the iframe.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
i m working in asp.net 2.0 and using database with it...made a table named ContactUs and stored procedures or_contactus_insert to insert the data and or_autogenerate to increment da contactid coulmn of contactus and classes, bt i m recieving an error of argument exception ..plz help me urgently..i m sending u code
Dim User As New CSUserInfo()
User.Or_FName = TxtFName.Text.ToString().Trim()
User.Or_LName = TxtlName.Text.ToString().Trim()
User.Or_Gender = RadioBttnListGender.SelectedItem.Text
User.Or_Email = TxtEMail.Text.ToString().Trim()
User.Or_PhoneNo = TxtPhoneNumber.Text.ToString().Trim()
User.Or_Street = TxtStreet.Text.ToString().Trim()
User.Or_Apartment = TxtApartment.Text.ToString().Trim()
User.Or_City = TxtCity.Text.ToString().Trim()
User.Or_State = TxtState.Text.ToString().Trim()
User.Or_Country = TxtCountry.Text.ToString().Trim()
User.Or_ZIP = TxtZip.Text.ToString().Trim()
User.Or_ContactByOrient = CheckContactByOrient.Checked
User.Or_Message = TxtTypemessage.Text.ToString().Trim()
Dim Orientconn As New SqlConnection
Dim SelectCommand As New SqlCommand
'Try
Orientconn.ConnectionString = System.Web.Configuration.WebConfigurationManager.AppSettings("Sconstring")
Orientconn.Open()
Dim OR_ContactIdDA As New SqlDataAdapter("OR_AUTOGENERATE", Orientconn)
OR_ContactIdDA.SelectCommand.CommandType = CommandType.StoredProcedure
OR_ContactIdDA.SelectCommand.Parameters.AddWithValue("@Tablename", "ContactUs")
OR_ContactIdDA.SelectCommand.Parameters.AddWithValue("@P_Key", "ContactId")
Dim OR_ContactIdDS As New DataSet("ContactUs")
OR_ContactIdDA.Fill(OR_ContactIdDS, "ContactUs")
'Dim IUserId As New ViewStateException
ViewState("IUserID") = Convert.ToInt32((OR_ContactIdDS.Tables(0).Rows(0)("ContactId")).ToString() + 1)////////i m getting error here dt contact id column is not of table contactus
''ViewState("IUserID") = Convert.ToInt32((OR_ContactIdDS.Tables("Or_ContactId").Rows(0)("Or_ContactId").ToString() + 1))
User.Or_ContactId = ViewState("IUserID").ToString()
Dim User1 As New CSUserDB
User1.InsertContactUs(User)
End Sub
samriti thakur
|
|
|
|
|
What error are you getting?
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Hi,
I developed a test webpage that uses dom comparevalidator and sets it controltovalidate as a textbox and run it in mozilla firefox then the validation are fired. but when i want to validate a drop down instead of a textbox validator doesn't work.
Can any one provide solution to this problem.
praveen
|
|
|
|
|
In order to validate drop downs use the Request.Form["mydropdown"] to get the text. Be sure to check for null before trying to access any properties.
regards,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
Hi all,
I am using repeater control(with paging) along with text box and search button on same page.
Textbox containing search criteria.
Everything is working fine,when records are more paging also works fine.But when I navigate to second page page get refreshed and textbox lost its value.
So I want to Keep my textbox value as it was when we navigate by link to second record page.
I hope you will help me........
|
|
|
|
|
Hi,
You loose your data, when posting back, so you need to save the value of the textbox when you page comes to the server, and in your Bind method, after you retrieve the values for the second page, retrieve the previously saved textbox value
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
Thanks for help..
Bye.............
|
|
|
|
|
You are welcome,
Was it helpful?
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
Hi..
I know how to use the application and session state variables and i have used the following code :
(In the Global.asax
protected static int m_ActiveUsers;
public static int ActiveUsers
{
get
{ return m_ActiveUsers;
}
}
protected void Application_Start(Object sender, EventArgs e)
{
Application.Lock();
m_ActiveUsers=0;
Application.UnLock();
}
protected void Session_Start(Object sender, EventArgs e)
{
Application.Lock();
++m_ActiveUsers;
Application.UnLock();
}
protected void Session_End(Object sender, EventArgs e)
{
Application.Lock();
--m_ActiveUsers;
Application.UnLock();
}
But the problem it doesnt give me the right number always.Some times this code tells me there is two visitors while there is no one except me.And some times it doesnt decrement the visitors count number when i exit.
Do any one know how to make a better way that wont be affected by application errors and will solve my problem?
"I am too late but i will never give up"
|
|
|
|
|
In global file
at application start
application("users") = 0
at form loads
Application("users") = CType(Application("users") , integer) + 1
label1.text = Application("users").tostring
|
|
|
|
|
Your code will count how many times users load the webform not how many users visit the website?!
"I am too late but i will never give up"
|
|
|
|
|
this is code is not right .
suppose currently 4 user are active and one of 4 user quit and again he comes back for him session will start form begining and session_start function calculate m_active user to 1 so it will give wrong result.
better is that maintain this variable m_active user in some file or database and increment and decrement it when user starts and end session.
hope this will work
Murtaza Tahir Ali Dhari
|
|
|
|
|
Thank you for your respond...
You said :and session_start function calculate m_active user to 1
As i know when a user quits and returns this will not restart the whole web application(Application_End) but will restart only one of the four users sessions(Session_End).I mean ending one session will not end other 3 sessions.
"I am too late but i will never give up"
|
|
|
|
|
Sir,
Can I rename the file programically in vb.net? If yes Please help me
Thanks and Regards
Amaneet Brar
|
|
|
|
|
Hi
I have a dropdown list with all the hub groups. When a hub group is selected, it loads and displays all the hubs for that hub group.
In my apsx code I have defined an empty table as follows:
<asp:Table id="tblHubCommRates" BorderWidth="0" Width="100%" runat="server">
</asp:Table>
When the hubs are loaded, I dynamically create the row, the cell, and the textbox. The textbox is called txtHub1, or txtHub7, depending on the hub ID from the database. The can be many hub for a selected hub group. Thus, many rows and may text boxes.
I would like to iterate through these dynamically generated textboxes to get there names, and the values in the textboxes.
When I do the following iteration (on 2 textboxes that were created):
foreach (Control c in this.tblHubCommRates.Controls)
{
Response.Write(c.GetType().ToString() + "<br>");
}
...it prints
System.Web.UI.WebControls.TableRow
System.Web.UI.WebControls.TableRow
I'm assuming the parent control is the table row's cell. But how do get the value of the textboxes in the cells?? Please can someone advise??
Regards,
ma se
|
|
|
|
|
I don't know why you are doing it this way instead of using a datarepeter or gridview but...
The table has a collection of TableRows, the TableRow has a collection of tableCells the TableCell has the textbox.
Try something like this...
private void TextboxValues(System.Web.UI.Control cntrl)
{
if (cntrl.GetType() = typeof(TextBox))
{
TextBox t = (TextBox)cntrl;
Response.Write(t.Text);
}
if (cntrl.HasControls)
{
TextboxValues(cntrl);
}
}
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
How do Iterate through these rows that I have created, then to iterate through the cells that I have created.. Then only do I think you above method should work.
|
|
|
|
|
Hello all,
I Need to Implement Free Text Search for my Application using ASP.NET 2.0. Can anyone give me article or proceedure for this.
awaiting for response
regards
GV Ramana
|
|
|
|
|
how to convert sql database into xml form in asp.net + c#.
Please give me some links.
Thanks in advance .
|
|
|
|
|
Hi,
You could use this stored procedure to convert the SQL Tables into xml
sp_makewebtask
You can have a look at this procedure from SQL books online.
Also you can export the contents of datatable using the code.
First you have to create a typed dataset, and then you fill the contents to the datatable in the dataset and then use the method
dataset.writexml to fullfill your requirement
Hope i have helped you out,
Happy Programming
|
|
|
|