|
hi ..
i want to know how to access database and insert row in datagrid using javascipt.
this is my existing code
<columns>
<asp:templatecolumn>
<headerstyle width="10%">
<itemstyle font-underline="True" horizontalalign="Center" width="10%">
<itemtemplate>
<asp:hyperlink id="Hyperlink1" cssclass="bluelink" runat="server" navigateurl="<%# "../CareHistory/CareEpisodeDetails.aspx?CareId="+DataBinder.Eval(Container.DataItem,"CareId").ToString() %>" width="16%">
View
<asp:boundcolumn datafield="CareCategoryName" headertext="Care Group">
<headerstyle horizontalalign="Center" width="25%">
<asp:boundcolumn datafield="CareStartDate" headertext="Date From" dataformatstring="{0:dd/MM/yyyy}">
<headerstyle horizontalalign="Center" width="10%">
asp:BoundColumn DataField="CareDateTo" HeaderText="Date To" DataFormatString="{0:dd/MM/yyyy}">
<headerstyle horizontalalign="Center" width="10%">
asp:BoundColumn DataField="ReasonForChange" HeaderText="Reason For Change">
<headerstyle horizontalalign="Center" width="15%">
asp:BoundColumn DataField="FundingAuthority" HeaderText="Funding Authority">
<headerstyle horizontalalign="Center" width="15%">
asp:TemplateColumn HeaderText="Risk at Home">
<headerstyle horizontalalign="Center" width="15%" verticalalign="Middle">
<itemstyle horizontalalign="Center" verticalalign="Middle">
<itemtemplate>
<asp:label id="lblRiskAtHome" runat="server" width="125px" text="<%# DataBinder.Eval(Container.DataItem,"HomeVisitingSafetyIssues") %>">
i need existing from to javascript like below
var grid = new AW.UI.Grid;
grid.setId("myGrid");
grid.setHeaderText("header");
grid.setCellText(function(col, row){return col + "-" + row});
grid.setColumnCount(10);
grid.setRowCount(1000);
grid.refresh();
how to get that row please help me
thank u
nantha
|
|
|
|
|
It's not a datagrid, it's a table on the client side. You need to add rows to the client side table. A repeater is probably better for you to control how things are laid out for the javascript.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi..Christian Graus
thank u soo much i will try that . thank u once again..
reg
nanth
|
|
|
|
|
Hi..
Friends.
I'm getting this error while changig in 'httpHandler' section in web.config
by following code..
Configuration objConfig = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
HttpHandlersSection sec = (HttpHandlersSection) objConfig.GetSection("system.web/httpHandlers");
sec.Handlers.RemoveAt(0);
HttpModulesSection sec2 = (HttpModulesSection)objConfig.GetSection("system.web/httpModules");
sec2.Modules.RemoveAt(0);
objConfig.Save(ConfigurationSaveMode.Full);
When, I m executing this code, I m getting this types of error message,
Access to the path 'c:\inetpub\wwwroot\FinalUploadProgress\web.config' is denied.
Please help me ASAP
Thanks in Advance..
Regards,
Abhi
|
|
|
|
|
check the authorization of ASP.NET and NETWORKSERVICE users. i got this error 6 days ago.
|
|
|
|
|
This code block is run on my developer pc. but i upload files to server then
I get an error "Object reference not set to an instance of an object"
on "dr.close"
whats wrong with this code?
Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate
Dim conn As New System.Data.OleDb.OleDbConnection(MyConstants.sqlConnString)<br />
Dim cmd As New System.Data.OleDb.OleDbCommand("", conn)<br />
Dim dr As System.Data.OleDb.OleDbDataReader<br />
Dim msG As String = ""<br />
Try<br />
conn.Open()<br />
cmd.CommandText = "SELECT * FROM MD_USERS WHERE U_USERNAME='" & Login1.UserName & "' AND U_PASSWORD='" & Login1.Password & "' "<br />
dr = cmd.ExecuteReader<br />
If dr.Read Then<br />
Dim mu As New MyUser<br />
mu._ID = dr.Item("U_ID")<br />
mu._Name = dr.Item("U_CLASS") & " " & Myuser.SayDignity(dr.Item("U_DIGNITY")) & " " & dr.Item("U_NAME") & " " & dr.Item("U_SURNAME")<br />
mu._CATEGORY = dr.Item("U_CATEGORY")<br />
mu._AUTHORITY = dr.Item("U_AUTHORITY")<br />
Session("MYUSER") = mu<br />
e.Authenticated = True<br />
End If<br />
Catch ex As Exception<br />
msG = ex.Message<br />
Finally<br />
dr.Close()<br />
conn.Close()<br />
End Try<br />
If Not msj = "" Then<br />
Session("msG") = msG<br />
Response.Redirect("Messages.aspx")<br />
End If<br />
End Sub
also What do u offer to improve this code?
|
|
|
|
|
greekius@hotmail.com wrote: dr.Close()
#1. You should check like ~
If dr IsNot Nothing Then If Not dr.IsClosed Then dr.Close()
#2. You should check whether dr is nothing or not before "dr.Read" too.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Declare this statement : Dim dr As System.Data.OleDb.OleDbDataReader
above of the function
Dim dr As System.Data.OleDb.OleDbDataReader
Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate
{
................
..................
..............
}
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
May be in this case you won't be getting dr object. Some exception happened before you issue ExecuteReader() , that will force to execute finally block. In finally block you are trying to close datareader that is not yet instantiated. To avoid this, make sure dr is not null before you try to close it.
greekius@hotmail.com wrote: also What do u offer to improve this code?
You need to look for some good articles that explains SQL Injection attacks. Your code is too close to that. I feel better approach would be using parameterized queries or Stored Procedures.
|
|
|
|
|
Parwej Ahamad wrote: Dim dr As System.Data.OleDb.OleDbDataReader
This won't solve prob I think. dr is not instantiating
|
|
|
|
|
I know but Execute reader return the reader object.
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
Parwej Ahamad wrote: know but Execute reader return the reader object.
Yes but what will happen if exception occurred before ExecuteReader() ? Then dr will not be instantiated
|
|
|
|
|
I agree, But i m post here as per the first post. if you want handle that kind of exception then we need to check Reader is null or not.
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
i think there is no prb wit "dr". 'cos this code works on my local pc. i guess the problem is about server. but what is that:s
|
|
|
|
|
Hello friend.
Do you know ? How to enable-disable web.config section in asp.net by
c#.net or vb.net code ?
I want to disable <httphandler> section by vb.net or C#.net code.
please, help me as soon as possible..
Thanks in advance.
Regards,
Abhi
|
|
|
|
|
Why do you want to do it? Changing web.config on the fly will make your webapp restart.
SG
|
|
|
|
|
Oh ! Yes.
Thanks for you suggestions...
|
|
|
|
|
Hi Everyone,
I need to capture the data from the out parameter of a stored procedure.
str = "{call <Mainframe-SPname>(<Parameters>)}"
Can anyone help me in this regard
-- modified at 3:02 Wednesday 22nd August, 2007
Regards,
Manowj
|
|
|
|
|
I have no idea about IBM DB2.
For SQL, it will be like that.
SqlConnection dbConn = new SqlConnection ("connectionstring");<br />
dbConn.Open ();<br />
SqlCommand cmd = new SqlCommand ();<br />
cmd.Connection = dbConn;<br />
cmd.CommandText = "mystoreProcedureName";<br />
cmd.CommandType = CommandType.StoredProcedure;<br />
SqlParameter param = new SqlParameter();<br />
param.Direction = ParameterDirection.Output;<br />
param.ParameterName = "paramOut";<br />
cmd.Parameters.Add (param); <br />
cmd.ExecuteNonQuery ();<br />
cmd.Dispose ();<br />
dbConn.Close ();
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
I am trying to build a list of items with checkboxes so that the users can remove several items from the list simultaneously. I have the list with the checkboxes displaying correctly. When I select a few items and click the remove button, event does not seem to be able to recognize that the items were selected.
I placed a blank table and CheckBoxList control on my page. I build the table to display the list during the Page_Load event. The list with checkboxes seems to work ok. When the RemoveItems_Click event fires, it cyles through the CheckboxList but it doens't recognized the Selected attribute so that I can remove the items.
Here are the relevant code snippets. Thanks for any feedback!
<asp:table id="ViewTable" runat="server">
<asp:checkboxlist id="RemoveItemsCheckBoxList" runat="server"
="" visible="False">
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetItemLists(RemoveItemsCheckBoxList);
}
}
public static void GetItemLists(CheckBoxList checkBoxList)
{
// Connect and fetch data
while (sqlDataReader.Read())
{
// build the ViewTable
// now create the checkbox and add it to the table
CheckBox checkBox = new CheckBox();
checkBox.ID = "RemoveCheckbox" + sqlDataReader["Id"].ToString();
checkBoxList.Items.Add(checkBox.ID.ToString());
cell = new TableCell();
cell.Controls.Add(checkBox);
row.Cells.Add(cell);
}
// clean up
}
protected void RemoveItemsButton_Click(object sender, EventArgs e)
{
foreach (ListItem listItem in RemoveItemsCheckBoxList.Items)
{
if (listItem.Selected == true)
{
// Remove the Item
...
}
}
|
|
|
|
|
I think you need to set AutoPost to true.
CheckBoxList1.AutoPostBack = true;
Hope it helps.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Hi!
I need some assistance.
I am using ASP.NET 2.0 Login Controls for my site and Roles are enabled. My problem is that I have a form with a dropdownlist. When a person signs on and he is in Role1 than all Role1 users must be displayed in the dropdown. If Role2 signs on then everyone from Role2 must be displayed.
Much appreciated!
Illegal Operation
Making Computer Software Talk
|
|
|
|
|
What is the life cycle of asp.net page
|
|
|
|
|
|
One of the most confusing things in ASP.NET
picture (big)[^]
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|