Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
K

ktrrzn

@ktrrzn
About
Posts
8
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • on Autocomplete, call ashx page to get data
    K ktrrzn

    hi RaviSant, As far as i know, u can use JSON format to return ur result from ashx file. and in the .autocomplete use options as parameter. like this.

    var options, a;
    jQuery(function(){
    options = { serviceUrl:'GenericHandler.ashx' };
    a = $('#query').autocomplete(options);
    });

    and in the web service class, return the JSON format like this.

    {
    query:'Li',
    suggestions:['India', 'Japan', 'United Kingdom', 'United States', 'Australia', 'France', 'China'],
    data:['IN','JP','UK','US','AZ','FR','CH']
    }

    query is the entered search key suggestions is the list to display in dropdown data is optional to use as value field when u select suggestion data from dropdown text To know more about JSON,here[^] To learn how to return JSON format from ashx, here[^] Ref: I get this code from devbridge.com[^] Hope this works!

    Please give any idea or suggestion on my advice.

    ASP.NET javascript question csharp asp-net design

  • How to save data and retrieve data from database using two tables in gridview?
    K ktrrzn

    hi snamyna, I think you are looping unnecessarily twice. Bcoz u already know the loop count of ur career that has Max marks The only for loop is sufficient, u don't need while loop as usual. I think, in ur mind, u confuse that SqlDataReader should be loop at the end of file. it is correct for common. but in ur case, u already know the loop count. Another problem is u assign the value dr2 to career (same variable) till the end of while loop without adding to placeholder, after u finish career variable will hold last value of dr2 so, u end up with last value and when u add to PlaceHolder1 the Label1.Text is last value. And then u loop again with For loop and start to query again, get the rows and while loop again loop until to last value and end up with last value, assign it to Label1.Text with exactly the same value(last row). So, as a suggestion, u juz re-arrange ur coding logic. Here:

    Dim cmdQuery2 As String = "SELECT Career FROM Analysis WHERE Marks= (SELECT MAX(Marks) FROM Analysis ) AND UserID = '" + kp + "'"

    Dim cmd2 As SqlCommand = New SqlCommand(cmdQuery2, con)
    Dim dr2 As SqlDataReader = cmd2.ExecuteReader()

    'con.Open()
    For i As Integer = 0 To labelCount - 1 '//** u can also u while loop in here the result will be same
    ' Create the label control and set its text attribute
    Dim Label1 As New Label

    dr2.Read()

    career= dr2("Career").ToString()
    Label1.Text = career '//** u can also directly assign the value from dr2 here

    Dim Literal1 As New Literal
    Literal1.Text = "
    "

    ' Add the control to the placeholder
    PlaceHolder1.Controls.Add(Label1)
    PlaceHolder1.Controls.Add(Literal1)

    Next
    dr2.Close()

    If u query is right, the problem is the order of ur coding logic. Hope it works!

    ASP.NET help question database algorithms tutorial

  • MoveNext is not moving next!!
    K ktrrzn

    hi Bomb_shell, As far as i know, in your problem, u assign the variable with first record and never assign it again when u loop and print out. So, as a suggestion, I re-order ur code. (I don't know much about VB)

    If objRec.EOF = true then
    Response.Write("<tr><td colspan=3>No reference documents exist for this card.</td></tr>")

    Else
    Do Until objRec.EOF

    ID2 = objRec("ID")
    RefDoc = objRec("RefDoc")
    RefRev = objRec("RefRev")
    RefNotes = objRec("RefNotes")

    Response.Write("<tr><td><a href='do\_UMID\_EditRefDocs.asp?RefDoc=" & RefDoc & "&Action=Delete&CardNo=" & CardNo & "'><img src='images/delete.gif' alt='Delete' border='0'></a>")
    Response.Write("&nbsp&nbsp<a href='UMID\_RefDocs.asp?CardNo=" & CardNo & "&RefDoc=" & RefDoc & "&Action=Edit'><img src='images/edit.gif' alt='Edit' border='0'></a>&nbsp&nbsp" & RefDoc & "&nbsp</td>")
    Response.Write("<td>" & RefRev & "&nbsp</td>")
    Response.Write("<td>" & RefNotes & "&nbsp</td></tr>")
     
    objRec.MoveNext
    

    Loop

    End If

    Hope it works!

    ASP.NET csharp asp-net database sysadmin regex

  • ListView selected item problem
    K ktrrzn

    Hi Farraj, As far as i know, you can use CSS[^] to get this functionality. There is some example and tutorial on Google[^]. if ur intention is only want to display what u selected. u can do that easily with CSS without post back. give all image control from list view to same CssClass name. then from css style sheet. change the image of outside frame. you can get a lot of jQuery[^] example for this.. Hope it works!

    ASP.NET help csharp database

  • How to save data and retrieve data from database using two tables in gridview?
    K ktrrzn

    Hi snamyna, As far as i know, in your problem, u can combine these two tables into one if they used QuestionId as primary key and if there is only one Answer for each Question in your database tables. If don't want to combine, here is some suggestion. you can use three temp DataTables: one for question and another one for answer. and final one for combination of both. u must declare SqlDataAdapter to **Fill** the DataSet and to **Update** them back. see example in : here[^] and here[^]

    DataSet dsTable = new DataSet();
    adapter.Fill(dsTable); // u need to create connection string and query string to fill the data from database.
    DataTable dtQuestion = dsTable["Question"]; // assign data result from question dataset
    DataTable dtAnswer = dsTable["Answer"]; // assign data result from answer dataset
    DataTable dtBind = dtQuestion.Clone(); // copy all data from Question
    dtBind.Columns.Add("Answer",System.Type.GetType("System.Boolean")); // create new column "Answer" with Boolean type, 1 for yes and 0 for no

    for(int index=0;index < dtBind.Rows.Count;index++)
    {
    for(int j=0; j < dtAnswer.Rows.Count; j++)
    {
    if(dtBind.Rows[index]["QuestionId"].Equals(dtAnswer.Rows[j]["QuestionId"]) // i assume that u used QuestionId as primary key for both Tables
    {
    dtBind.Rows[index]["Answer"] = dtAnswer.Rows[j]["Answer"];
    break; // break from inner loop
    }
    }
    }

    and bind it to gridview from codebehind file.(.asp.cs)

    GridView1.DataSource = dtBind;
    GridView1.DataBind();

    you need to change your girdview databound column

    ASP.NET help question database algorithms tutorial

  • document.getElementById Not work With Masterpage ASP.Net VB
    K ktrrzn

    Hi, I suggest this solution, it works for me. in your JS add variable, and assign the ClientID of ur label control.

    <b>var slbltime = '<%=lbltime.ClientID%>'</b>

    window.onload = WindowLoad;
    function WindowLoad(event) {

    ActivateCountDown("CountDownPanel1", document.getElementById(<b>slbltime</b>).value, "CountDownEnded1");

    }

    bcoz when .Net render asp control to html control, they need to give id to it. if u use asp:label control, the id will transform into 'Master_ct00_lbltime' something like that. as far as i know, what other member want to say is if u assign value into ur label control from code behind file(.aspx.cs) u need to do b4 PreRender state of page life cycle. PreRender is the state b4 the asp:control are actually transform into html control to send it to the web browser. Hope it works!

    ASP.NET csharp javascript asp-net help

  • Problem with a require input field DropDownList if old records have null in this field
    K ktrrzn

    Hi Kobus, I suggest this solution: use javascript to check ur default value b4 post it to server.

    var sDropDownList_HP = '<%=DropDownList_HP.ClientID %>';
    // var slblMsg = '<%=lblMsg.ClientID %>';

    function validateHospitalDropDownList()
    {
    var ddlHP = document.getElementById(sDropDownList_HP);
    if(ddlHp.selectedIndex<1){
    // document.getElementById(slblMsg).innerHTML= "Please select Hospital";
    return false;
    }
    else{
    return true;
    }

    }

    In your asp code: there may be some button click event to post back to server: I assume u have that button,

    OnClientClick="if(!validateHospitalDropDownList())return false;" Text="Submit" />

    then add attribute OnClientClick and assign JS function to it, if this function return true, the form will post back normally, else no post back will occur. you can also add some code to show error msg in the JS function. Hint: in Data Null case, u can use ISNULL('value that can be null', 'new replace value'); function from SQL. Hope that works!

    ASP.NET database help html sql-server com

  • problem in displaying the data in datagrid`
    K ktrrzn

    Hi Mani, in your problem, u can save your last data in datatable variable. To use session variable,

    Session["mySearchResult"] = searchResultTable;
    searchResultGridView.DataSource = searchResultTable;
    searchResultGridView.DataBind();

    When u search new keyword and return data back from server, save it in temp table. then retrieve your previous saved table from Session. and Loop through every row again and add it into old table and re-save it to Session.

    newSearchResultTable = // new search result data from server;
     searchResultTable  = Session\["mySearchResult"\] as DataTable;    // get back from session
     foreach(DataRow row in newSearchResultTable.Rows)               // loop every rows
     {
         searchResultTable.Rows.Add(row);                            // add to existing table
     }
    
     Session\["mySearchResult"\] = searchResultTable;                  // save back and bind again
     searchResultGridView.DataSource = searchResultTable;
     searchResultGridView.DataBind();
    

    Hint: when u enable the "EnableViewState" to false, your selected info will not be avaliable from the server. Hope it works,

    ASP.NET database algorithms help tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups