jbisono 51 Posting Pro in Training

Oh thats really not good, believe me I went thru that once, specially when they dont document anything or comment out. I guess you have to make sure that you can rebuild that project because some companies does not give you the whole source to modify internally, but if you need to get that done quick, take a look sending email thru the db server. I use this stored procedure "xp_smtp_sendmail" is a third party tool that you have to register to sql server. and then you can create a trigger and send the email at the database level.

But that is just a workaround definitely you need to make sure you can update the source recompile the project then we can help you.

jbisono 51 Posting Pro in Training

You need something like this

SELECT COUNT(ID) AS EmploCount, DEPARTMENT_ID, Salary
FROM (SELECT     ID, DEPARTMENT_ID, CASE WHEN salary < 5000 THEN 'Less than 5000' ELSE CASE WHEN salary BETWEEN 5000 AND 10000 THEN 'More thant 5000 and less than 10000' ELSE 'More than 10000' END END AS Salary 
FROM Employee) AS derivedtbl_1
GROUP BY DEPARTMENT_ID, Salary
jbisono 51 Posting Pro in Training

I do not use too much SqlDataSource but i believe you can do this

if (DropDownList1.SelectIndex > 0)  
{ 
    SqlDataSource1.FilterExpression = "FieldInYourDataSource = " + DropDownList1.SelectedItem.Value;
}
else 
{ 
    SqlDataSource1.FilterExpression = null;
}

Try something like that. but if you really want to build your sql statement and query the database let me know, take in consideration that by doing that you lose some of the features provide by the sqldatasource control.

regards.

jbisono 51 Posting Pro in Training

Can i see that piece of code? and what namespace are you using? System.Net.Mail?

jbisono 51 Posting Pro in Training

Ok i am assuming that particular button is out of the datagrid in that case in the click event method for that button you'll have something like this.

For Each row As DataGridItem In grdData.Items
'Now this loop will run over each row in the datagrid, but the fact that you are using ItemTemplate you will have to cast in order to get your values.
Dim services_Desc As String = DirectCast(row.FindControl("lblRank"), Label).Text
'Now the variable service_Desc contain the services_desc for that particular row. I am not that good with vb but DirectCast is to cast the control found by the FindControl method to a label and then get the text property. in case you bound the items without ItemTemplate doing row.Cells(0).Text to get the first column text for the first row.
Next

i hope it help you.

jbisono 51 Posting Pro in Training

Are you using C# or VB?

jbisono 51 Posting Pro in Training

What exactly does not work? its just the program wont start at all, or it crash at certain point?

jbisono 51 Posting Pro in Training

The first one.

jbisono 51 Posting Pro in Training

You have two options:
first: you can create a extra column in your query to return true or false if your part No start with your criteria, then bound that to the checkboxcolumn.

Second: you have to use the DataGrid.OnItemDataBound Method here is an example then with in that method you will have to compare your format with the part being bound in the datagrid and then check or not your checkbox column.

jbisono 51 Posting Pro in Training
jbisono 51 Posting Pro in Training

I use FusionChart Free, there is a pay version but if you want something simple and easy to use this is one of the best for me.

jbisono 51 Posting Pro in Training

another way to retrieve just one value from the database is using the executescalar method.
in that case you will add after this line

Dim commando As New SqlCommand(sql,SQLConn)
SQLConn.Open()
EditItem.Text = commando.ExecuteScalar().ToString()
SQLConn.Close()

ExecuteScalar return an object. so maybe you want to check if that object is not null first.
Try that.

jbisono 51 Posting Pro in Training

My opinion is, first HTML is not a programming language, is a MARKUP, TECHNOLOGY what ever you want it to call it, but not a programming language.

About math, i would say that all depends on what you are programming, but indeed you can do a lot of work with just the basic math functions.

jbisono 51 Posting Pro in Training

Cool.

jbisono 51 Posting Pro in Training

This is what i use if i want to open a new page.

I create a static class like this.

public static void OpenWebSite(string webUrl, Control cntrl)
        {
            ScriptManager.RegisterStartupScript(cntrl, cntrl.GetType(), "Open", "window.open('" + webUrl + "');", true);
        }

And then whenever i want to open a particular web site i do this in c# code
this code below goes within the imagebuttonclick event.

OpenWebSite("yoururl.com?parm=paravalue", this);
jbisono 51 Posting Pro in Training

can you be more specific about what you do not understand?

jbisono 51 Posting Pro in Training

This is from head so try it. Replace with your original field name.

select first_name, last_name, count(match_id) as match_total, sum(match_points) as match_points
from player
group by first_name, last_name
having count(match_id) > 10 and sum(match_points) > 330

regards

jbisono 51 Posting Pro in Training

oh ok well the easiest way is use group

SELECT MAX(IDREPORT) AS IDREPORT, IDHARDWARE
FROM REPORT
GROUP BY IDHARDWARE
jbisono 51 Posting Pro in Training

if you need the last reportid how come you have reportid 86 in your example picture? because if reportid is integer in increment by one you need something like this.

SELECT TOP 1 IDREPORT
FROM Report
ORDER BY IDREPORT DESC

but again i dont know why do you have two results.

jbisono 51 Posting Pro in Training

Uhm you can try this

for(int i = 0 ;i < numberOfDays; i++)
 {
    TextBox tb = new TextBox();
    tb.ID = "txt" + i;
    form1.Controls.Add(tb);
 }

regards.

jbisono 51 Posting Pro in Training

DateTime.Today.ToShortDateString();

Use ToShortDateString() Method.

jbisono 51 Posting Pro in Training

Uhmm, so basically one profile can has multiple address link to it? that is your relation between both tables?

jbisono 51 Posting Pro in Training

Excellent!!! that is the best part.

jbisono 51 Posting Pro in Training
<input type="button" value="Disable all DropDownList" onclick="DisableDropDown();"/>
<script language="javascript" type="text/javascript">
function DisableDropDown()
{
   var x = document.getElementsByTagName("select");
   for(var i = 0; i < x.length; i++)
   {
      x[i].disabled = true;
   }
}
</script>

if you need to disable just a few dropdownlist then you have to put a classname to those dropdownlist and create a function to find every element with that classname. well if you know a little bit of jquery or something like that is easier.

jbisono 51 Posting Pro in Training

Its hard to say without viewing that particular table structure, in what data type are you saving the hour in the database? i have seen people who use float type and others datetime.

jbisono 51 Posting Pro in Training

Thanks.

jbisono 51 Posting Pro in Training

i bet you dont need to include all this reference but i need it because i made like a report builder anyway. maybe this can help you. oh this is c# but you should be able to translate that to vb.net

using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.ReportSource;
using CrystalDecisions.Web;

// now under your method

ReportDocument rpt = new ReportDocument();
rpt.Load(Server.MapPath("~/reports/reportname.rpt"));
rpt.SetDatabaseLogon("user", "pass");
rpt.SetParameterValue("ParamName", "ParamValue");
CrystalReportViewer1.ReportSource = rpt;

here is a converter tool

Good luck

jbisono 51 Posting Pro in Training

Hi I initially start this thread, but now another issue came up. Tha fact that im creating the dropdownlist in the fly within a treeview asp.net control, now i want to have one button that when pressed go thru every node in the treeview and get me the selected value from the dropdownlist and the text along with it.

Thanks for any help you can provide me.

jbisono 51 Posting Pro in Training

look i can give you a loop for that right now, but let me ask you this, why if you want to retrieve all the record where the level goes from 1 to 8, why dont you say and your stored procedure "where level between 1 and 8" and that case you make just one request to the server and get all the record you need.

fadi-ft commented: good man +1
jbisono 51 Posting Pro in Training

I still dont get what is your problem, but it sounds like you need a recursive function or a loop somewhere. you have to explain a little bit more.

jbisono 51 Posting Pro in Training

I really appreciate the help guys!!!. I am happy with the solution given by dnanetwork adding the dropdownlist in the fly refer above. he recommend me to put a button along the dropdownlist too in order to retrieve the selected item, but actually i would like to have just one update button to go thru the treeview and find selected item in the dropdowlist and the node text. i guess its better to open a new thread for this question?

jbisono 51 Posting Pro in Training

You know, that might work, i could get what i want. Now i have my part and my dropdownlist in the same row, I need a button that when pressed, go thru each node and get me the part and the value selected from the dropdown.

jbisono 51 Posting Pro in Training

No problem. If i find something interesting i let you guys know. thanks for your help.

jbisono 51 Posting Pro in Training

I have been playing with your first link, no results so far, maybe the fact i am programming asp.net in to windows application is giving me trouble.

the second link will always helpful if i decide to buy telerik controls.

but yes what i want to accomplish is http://www.codeproject.com/KB/tree/DropDownTreeView.aspx but in a web environment.

jbisono 51 Posting Pro in Training

ohhh you mean like making the options checkboxes instead of dropdown within the treeview?

jbisono 51 Posting Pro in Training

To answer rohand, thanks for your reply. I try to do what you said, first i want to add the dropdown at the treenode levels, second you are right treeview has controls collection but if i try to add a new control it said this "'System.Web.UI.WebControls.TreeView' does not allow child controls.".

dnanetwork i am not sure what is what you want me to do.

to re example my issue this is the scenario imagine having a bill of material which to make one part you need maybe one or multiple parts.


Part1
Part1a "at this level i would like to show a dropdown, showing how the part can be built, even purchase or assembly it"
Part1b
Part2
Part2a

jbisono 51 Posting Pro in Training

Hello friends, I am trying to approach a procedure but i am stock trying to add a DropDownList control into a TreeView Control, there is no TreeNode.Control.Add(). can somebody give an idea how can i go for this.

thanks.

jbisono 51 Posting Pro in Training

Hi, i do not too much about vb, but for the most part c# and vb share the same concepts, so maybe what you need is parsing the find control to a panel like this.

Dim pnl As Panel = (Panel)Me.Parent.FindControl("Panel1")
jbisono 51 Posting Pro in Training

Thanks for your reply. Finally i use the emptytemplate to put a listview and did the procedure to insert the first item.

jbisono 51 Posting Pro in Training

Hello my friends.
I am having problem with a GridView that its been filled by a LinqDataSource, and the footer i have the option to insert a new row, but if the DataSource is empty the footer wont show up. What is the best option to fix this.

Thanks.

jbisono 51 Posting Pro in Training

I have a common class and one of my method is this one

public static void Message(String message, Control cntrl)
        {
            ScriptManager.RegisterStartupScript(cntrl, cntrl.GetType(), "alert", "alert('" + message + "');", true);
        }

then any time i want to display a message i just call that method like this.

Message("Any message here", this);

hope that help.

jbisono 51 Posting Pro in Training

Hey did you fix your problem? Sorry for the delay.

jbisono 51 Posting Pro in Training

You have to add the OnRowDataBound method for the gridview. so add this method and give it a name like this OnRowDataBound="BoundRow" then lets implement the method. in your source code create a method called BoundRow.

protected void BoundRow(object sender, GridViewRowEventArgs e)
{
      if (e.Row.RowType == DataControlRowType.DataRow)
      {
            if(e.Row.Cells[2].Text = "Yes")
            e.Row.Cells[2].ForeColor = System.Drawing.Color.SomeColor;     
            else
          e.Row.Cells[2].ForeColor = System.Drawing.Color.Someothercolor;     
      }
}
jbisono 51 Posting Pro in Training

Line 39 should be like this
SqlCommand cmd1 = new SqlCommand("usp_selectnodes", conn1);

jbisono 51 Posting Pro in Training
SELECT * FROM table1 JOIN table2 ON table1.ID=table2.ID JOIN table3 ON table1.ID=table3.ID WHERE (table1.someotherfield='b') and  (table1.someotherfield='a')
jbisono 51 Posting Pro in Training

it seems like a problem in your web.config leave your custom error set to off and then copy and pase all your web.config content into a notepad and save the document as xml, try to browse the xml file in the browser. If the xml file is unable to be rendered by the browser and throws some errors, then you can find the place where the tags are not well formed and fix them. also remember that web.config is case sensitive.

jbisono 51 Posting Pro in Training

try do the same thing but move DataGrid1.DataBind() and DataGrid1.Dispose() to the last line of the method.

jbisono 51 Posting Pro in Training

Can you show the method used to save the data?

jbisono 51 Posting Pro in Training

Did you try this and did not work?
"<customErrors> tag should then have its "mode" attribute set to "Off".""
<customErrors mode="Off" />

jbisono 51 Posting Pro in Training

Try this.

<asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:DataList ID="DataList1" runat="server" OnItemCommand="GetDetails">
            <ItemTemplate>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true">
                <ContentTemplate>
                    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                    <asp:Button ID="Button1" runat="server" CommandName="Test" Text="Button" />
                </ContentTemplate>
                <Triggers>
                <asp:AsyncPostBackTrigger ControlID="Button1" />
                </Triggers>
            </asp:UpdatePanel>
            </ItemTemplate>
        </asp:DataList>

in the source code create a function like this

protected void GetDetails(object sender, DataListCommandEventArgs e)
    {
        if (e.CommandName == "Test")
        {
            ((TextBox)e.Item.FindControl("TextBox1")).Text = "Hi";
        }
    }

This last funcion will write the text Hi to the TextBox1 that belong to the current row clicked.