|
hi all,
i have a daily user table contains user name,price of product etc.
i have to place each and every user information in the data grid along with a
check box infront of the user name.
can any one help me how to generate check boxes dynamically.
thanx in advance....
your
peter
|
|
|
|
|
You can use checkboxlist control to generate the checkboxes dynamically. you can assign source to the checkboxlist control and bind that to make it ready for use.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi there,
Are you sure that you need dynamic checkbox controls? Anyway, you can find lots of datagrid examples from the datagridgirl[^] site
|
|
|
|
|
Hi,
I am using dataview.sort property to sort my datagrid by date column.
following is the syntex i am using.
dataview.sort=dataset.tables[index].columns["columnname"].tostring();
this sorts my datagrid in ascending order.i want to sort in descending order.
it looks very easy, i tried diff. syntex, but not working out.
please help me if any body can.
Thanks,
Nikki
-- modified at 17:30 Thursday 22nd June, 2006
|
|
|
|
|
|
I can't able to find the syntex for DESC order which fits in my problem. I am using following syntex. but where should & how should i include the key word DESC in my coding line.Thanks,
dataview.sort=dataset.tables[index].columns["columnname"].tostring();
Nikki
|
|
|
|
|
You simply concatenate the DESC keyword after the column name:
dataview.sort=dataset.tables[index].columns["columnname"].tostring() + " DESC";
|
|
|
|
|
When I concatenate the DESC keyword after the column name, It's not returning any value to Datagrid. I tried the same syntex.
Thanks,
NIKI
|
|
|
|
|
i dont know why tis application wont works...
it keep giving me the first records in the database and populate it twice, when i wanted both 2 different records to appear...
if possible help me debug this or give me some comments...
thanks in advance...
Dim aryTest(2) as integer
arytest(0) = 1
arytest(1) = 2
Dim objAdapter As New SqlDataAdapter
Dim objDs As New DataSet
Dim ojDataRow As DataRow
Dim objArrayList As New ArrayList
objCMDB = New cCMDB
Dim i As Integer
For i = 0 To 1
mobjcmd.CommandText = "SELECT Contract_Ref,Equipment_Status, " & _
"Technology_Refresh_Eligibility, Configuration_Item_Description, " & _
"Configuration_Type, Maintenance_Contract, Procurement_Vendor, " & _
"Warrenty_Ends, Warrenty_Period FROM tblCMDB WHERE" & _
"Configuration_Item_ID = "& aryTest(i) & ""
mobjcmd.SelectCommand = mobjcmd
objAdaptor.Fill(objDs, "tblcCMDBRecords")
objDataRow = objDs.Tables("tblcCMDBRecords").Rows(0)
objcCMDB.ContractReference = objDataRow.Item("Contract_Ref")
objcCMDB.EquipmentStatus = objDataRow.Item("Equipment_Status")
objcCMDB.TechnologyRefreshEligibility = objDataRow.Item
("Technology_Refresh_Eligibility")
objcCMDB.ConfigurationItemDescription = objDataRow.Item
("Configuration_Item_Description")
objcCMDB.ConfigurationType = objDataRow.Item("Configuration_Type")
objcCMDB.MaintenanceContract = objDataRow.Item("Maintenance_Contract")
objcCMDB.ProcurementVendor = objDataRow.Item("Procurement_Vendor")
objcCMDB.WarrentyEnds = objDataRow.Item("Warrenty_Ends")
objcCMDB.WarrentyPeriod = objDataRow.Item("Warrenty_Period")
objArrayList.Add(objcCMDB)
Next
MobjCn.Close()
Return objArrayList
i@@
|
|
|
|
|
You need to recreate the new objcCMDB object in the for loop statement, otherwise it will overrite the current object.
|
|
|
|
|
thx dude thx for ur help... u save me...
|
|
|
|
|
Ok, this has me stumped. I am trying to get a single record from the DB, which may or may not be NULL.
Dim cmdSelect As New SqlCommand("SELECT weblink FROM dbo.environment WHERE id = 7, sqlDB)<br />
sqlDB.Open()<br />
<br />
sqlRead = cmdSelect.ExecuteReader<br />
<br />
If Not sqlRead.IsDBNull(0) Then<br />
'...Do something with result<br />
Else<br />
'...Do something with NULL<br />
End If
Yet when I do the test using 'If Not sqlRead.IsDBNull(0) Then' , it throws and error: Invalid attempt to read when no data is present.
Yes, I know theres nothing there, thats what I am trying to test.
I cant find anything about how this should work, all examples seem to expect data to be coming back. Help!
|
|
|
|
|
You must call sqlRead.Read() first.
Kelly Herald
Software Developer
MPC
|
|
|
|
|
Oh that was easy, thanks! I would have thought the .ExectueReader command would have sorted that out, but obviously not..
|
|
|
|
|
I have a regular ASP.NET TreeView control on my page that is auto populated from an XML file using DataBindings. In the SelectedNodeChanged event handler routine, I have it make the text of the selected (clicked) node bold.
My problem is: It doesn't matter which node I click on, it always bolds the top most node in that level of the tree. It never bolds the node I selected unless it is the top most node of a level.
It appears as if the page is doing a postback to the server (as it should). But I am not sure if that is the issue. How do I make it so that the node I click on stays "clicked".
Here is what I am talking about:
If this is my tree (below) and I click on "VBScript" it bolds "XML" when it should actually bold "VBScript".
Main
XML
XHTML
Visual C++
Visual Basic
VBScript
UML
PS. Is there a way to implement a control-click event for the TreeView control?
-- modified at 18:59 Wednesday 21st June, 2006
|
|
|
|
|
Do the TreeNodes have the same value? Make sure they should have different values for each node
|
|
|
|
|
That was the problem. Thanks for the tip.
|
|
|
|
|
I am trying to add an Event Procedure to a text field such that pressing the ENTER keyboard button activates the same procedure as clicking the submit button on the form. Apparently asp.net's textbox control does not have an ability to generate those kind of event. Or is there any way to do this?
Thank you
|
|
|
|
|
You can write a javascript function that gets called on the client-side onkeydown (not onkeypress) event. Check that if the character pressed is 13 (ENTER) then submit your form.
Hope that helps.
"Democracy is two wolves and a sheep voting on what to have for dinner" - Ross
Edbert
Sydney, Australia
|
|
|
|
|
I don't get the loading of an EditItemTemplate to work.
When I try to get the TextBox with FindControl from within the editTemplate I get the error message "Object reference not set to an instance of an object".
When I simply add the editItemTemplate in the .aspx-file it works fine, but not when it's loaded from file. This is how my code looks like:
<code> protected void Update_command(Object sender, DataListCommandEventArgs e)
{
error---> row["Description"] = ((TextBox)e.Item.FindControl("txtDescription")).Text;
}
protected void Page_Init(object sender, EventArgs e)
{
//om man är inloggad skall man ladda in ett annat template för datalistan med ändra-länk
if (Session["loggedIn"] != null && (bool)Session["loggedIn"] == true)
{
listItems.ItemTemplate = Page.LoadTemplate("productItemTemplate.ascx");
listItems.EditItemTemplate = Page.LoadTemplate("productEditItemTemplate.ascx");
}
}</code>
content of file productEditItemTemplate.ascx:
<code>Change article:
<asp:TextBox ID="txtDescription" runat="server" Text=' <%# Eval( "Description") %> ' ></asp:TextBox><br />
Image file: <asp:TextBox ID="txtImage" runat="server" Text=' <%# Eval("Image") %> ' ></asp:TextBox><br />
Price: <asp:TextBox ID="txtPrice" runat="server" Text=' <%# Eval("Price") %> ' ></asp:TextBox><br />
<asp:LinkButton ID="btnOk" runat="server" Text="OK" CommandName="update" />
<asp:LinkButton ID="btnDelete" runat="server" Text="Delete" CommandName="delete" />
<asp:LinkButton ID="btnCancel" runat="server" Text="Cancel" CommandName="cancel" /></code>Grateful for any help on this subject!
Gulllet
|
|
|
|
|
Because the FindControl method looks for the specified control within the scope of the naming container which you call the method. Here, you place the textbox control in a web user control which is a naming container, so you need to get reference to the user control before calling the FindControl:
e.Item.Controls[0].FindControl("txtDescription")
|
|
|
|
|
Yeah, that works fine. Thanx!
Gulllet
|
|
|
|
|
One of my websites has several hundred pages designed using old fashioned ASP. I'm now trying to add new pages/functionality using ASP.NET 2.0.
For the most part, this integration is going smoothly.. the one thing I'm really struggling with is cookies. The website has a "members" section and all member pages check for the existence of a specific cookie - if it's null the user gets redirected to the login page. The login page, which creates the cookie is done using old ASP, and I just can't seem to figure out how to check for the existence of this cookie using ASP.net code on my "new" pages - I keep getting an "Object reference not set to an instance of an object" error. The code I'm trying to use is:
If IsNothing(Request.Cookies("Member")("ID")) Then
' move to login page
End If
I'm guessing the solution is fairly simple, but it's eluding me so far. Any advice would be much appreciated.
|
|
|
|
|
From what I read ASP cookies are HTML-encoded, so you need to HTML-decode it first before using it in ASP.Net.
Try checking whether the "Member" cookie is null or it has some encoded values.
Hope that helps.
"Democracy is two wolves and a sheep voting on what to have for dinner" - Ross
Edbert
Sydney, Australia
|
|
|
|
|
I have an XML Control that takes its datasource location from the query string.
but i only want it to be able to open XML files from a certain folder on the server.
At the moment I use crpytography to make sure only links on the page (that link to the files i want it to be able to open)can pass these vales via URL to the query string.
Though i was hoping there was a simpler way to do this like control what files the XML can open files from.
|
|
|
|