|
|
Hi Guys
Is it possible to show two columns in a Listbox?
thanks
Deliver yesterday, code today, think tomorrow.
"http://www.heuse.com/cphumor.htm"
|
|
|
|
|
No there is no way to show to coloumns in ListBox as per my knowledge
Why do you want to show 2 coloumns in one ListBox ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
I need to show the ID and the description of a field
Deliver yesterday, code today, think tomorrow.
"http://www.heuse.com/cphumor.htm"
|
|
|
|
|
There is another way put the description as tool tip instead
or create one arrayList with ID +" add space "+description
and use this array list as datasource to listbox
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
Perfect, that is what I needed, thanks!
Deliver yesterday, code today, think tomorrow.
"http://www.heuse.com/cphumor.htm"
|
|
|
|
|
Do that CONCAT your column fields in Your Query.and get return back it
then bind your List.
Like this
select (id +' | ' +name )as name,id from Emp
and bind your
List.DataTextField="name";
List.DataValueField="id";
..............
..............
Deepak
Smile a Lots,Its Costs Nothing
|
|
|
|
|
I have a user control which is used in three different place of page. i have to save the data from each of these user control
to first datatable(temporary) and then finally from that datatable to database.
so if i have a usercontol1 which have textboxes and submit button (temp_submit) these user control is used in different place of same page
so when i press temp_submit from one place i.e where usercontrol is used, it should save to datatabe now again if the same user control
from another place in page, if button (temp_submit) is clicked the then the values of text box should be append to that datatable
and latter on when i click main submit button every thing should be save to datatbase.
|
|
|
|
|
Just create a property that will differetiate between the control's submit button will update database and the control's submit button will update DataTable
Assign this property in while decalring the cotrol only
<UC:UCNAME id="IDPARYT" UpdateDatabase="true" runat="server"></UC:UCNAME >
lt;UC:UCNAME id="DontUpdate" UpdateDatabase="False" runat="server"></UC:UCNAME >
In code Behind in button click just check this property
if(UpdateDatabase)
{
Update Database
}
else
{
Update Data Table
}
If things are very comlicated then create different user control instead
it is not going to hit perforamance any way
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
hi
is it possible that i open a invisible window open through javascript. is there any attribute of the java function window.open property invisible?
I will do my best?
Integrated Solutions, Bikaner (Raj.), India
|
|
|
|
|
I think for that you will have to write invisible javascript code
just kidding
Not possible i think
Can you tell why you want to open such window ?
Whats the requirement
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
You can do one think, just set height and width of window to 1 ,1 and set left and top to 4000 or such a value that will come in resoulation.
hope this will helps you
cheers,
Abhijit
Think Sharp | Code Sharp | C Sharp
|
|
|
|
|
This method will be blocked by every single popup blocker out there....for very good reason. There is no (i repeat: NO) legitimate reason to want to hide a popup from a user.
|
|
|
|
|
Hi,
I have been getting the following error message whatever I tried to get rid of it, I couldn't succeed it. How can solve the problem? I tried to define the dropdownbox with (Dim myYearBox as New Dropdownlist) and it didn't work out too.
Error message is :"Object Referance not set to an instance of an object"
<br />
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load<br />
<br />
<br />
If Page.IsPostBack = False Then<br />
<br />
<br />
Dim myYearBox As DropDownList = CType(FormView1.FindControl("GetYear"), DropDownList) '<< ERROR<br />
<br />
myYearBox.Items.Insert(0, Now.Year.ToString)<br />
myYearBox.Items.Insert(1, (Now.Year + 1).ToString)<br />
<br />
<br />
'GetYear.Items.Insert(0, Now.Year.ToString)<br />
'GetYear.Items.Insert(1, (Now.Year + 1).ToString)<br />
<br />
Call populateDayFromBox(Now.Year, Now.Month)<br />
<br />
End If<br />
<br />
End Sub<br />
<br />
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Make sure GetYear is spelt correct and is in the formview
How do you know which line is object reference?
Deliver yesterday, code today, think tomorrow.
"http://www.heuse.com/cphumor.htm"
|
|
|
|
|
It is spelled correctly and it is inside the formview. The error line was pointing the line where the line marked '<< Error'
Thanks.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Hi,
Try to check FormView1.FindControl("GetYear") is returning null. To my experience FindControl in Asp.Net sometimes returns null even if the control is there. I think this is why you are getting this problem. Put a check on the code if its null then do something else.
Regards
|
|
|
|
|
Hi Jaffer,
The problem is dropdownboxes are not bind to any dataobjects. I was aimed to populate these boxes in runtime. However if I bind them to an objectdatasource, I am not able to define an event eg. (Dropdownbox_Clicked) because they are inside of th Formview control.
Therefore, I decided not to bind them and I don't use formview now. However now I am facing to another issue, How I am giong to assign their values as inputparameter to objectdatasource insert event below.
Here is the code sample. All I need to pass 5 doprdownboxes selectedvalue arguments to below procedure as inputparameters. When I click a button, these paramaters must be carried to following procedure.
<br />
Private Sub ObjectDataSource1_Inserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs) Handles ObjectDataSource1.Inserting<br />
<br />
Dim ParamsFromPage As IDictionary = e.InputParameters<br />
<br />
Dim NewObj As New property_availability(0, 0, 0, 0, "")<br />
<br />
NewObj.Getyear = Int32.Parse(ParamsFromPage("GetYear")).ToString<br />
NewObj.GetMonth = Int32.Parse(ParamsFromPage("GetMonth")).ToString<br />
NewObj.GetDayFrom = Int32.Parse(ParamsFromPage("GetDayFrom")).ToString<br />
NewObj.GetDayTo = Int32.Parse(ParamsFromPage("GetDayTo")).ToString<br />
NewObj.GetStatus = ParamsFromPage("GetStatus").ToString<br />
<br />
ParamsFromPage.Clear()<br />
<br />
ParamsFromPage.Add("GetYear", NewObj.Getyear)<br />
ParamsFromPage.Add("GetMonth", NewObj.GetMonth)<br />
ParamsFromPage.Add("GetDayFrom", NewObj.GetDayFrom)<br />
ParamsFromPage.Add("GetDayTo", NewObj.GetDayTo)<br />
ParamsFromPage.Add("GetStatus", NewObj.GetStatus)<br />
<br />
End Sub<br />
<br />
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Instead of using the object datasource to insert, why dont you call your busines object's insert method directly??
Alexei Rodriguez
|
|
|
|
|
I use Business object's insert method actually. Please see the code below. However I decided not use Formview because in runtime I must control dropdownboxes and their events. Now I am not able to pass the values of these boxes to below procedure because this boxes are not bind to objectdatasource anymore. I have to externally bind them somehow but I don't knwo how to do that.
<br />
Private Sub ObjectDataSource1_Inserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs) Handles ObjectDataSource1.Inserting<br />
<br />
Dim ParamsFromPage As IDictionary = e.InputParameters<br />
<br />
Dim NewObj As New property_availability(0, 0, 0, 0, "")<br />
<br />
NewObj.Getyear = Int32.Parse(ParamsFromPage("GetYear")).ToString<br />
NewObj.GetMonth = Int32.Parse(ParamsFromPage("GetMonth")).ToString<br />
NewObj.GetDayFrom = Int32.Parse(ParamsFromPage("GetDayFrom")).ToString<br />
NewObj.GetDayTo = Int32.Parse(ParamsFromPage("GetDayTo")).ToString<br />
NewObj.GetStatus = ParamsFromPage("GetStatus").ToString<br />
<br />
ParamsFromPage.Clear()<br />
<br />
ParamsFromPage.Add("GetYear", NewObj.Getyear)<br />
ParamsFromPage.Add("GetMonth", NewObj.GetMonth)<br />
ParamsFromPage.Add("GetDayFrom", NewObj.GetDayFrom)<br />
ParamsFromPage.Add("GetDayTo", NewObj.GetDayTo)<br />
ParamsFromPage.Add("GetStatus", NewObj.GetStatus)<br />
<br />
End Sub<br />
<br />
<br />
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Unless im missing something, i dont see any sense on this previous code
You read the values from e.insertparameters into ParamsFromPage
Yo add ParamsFromPage into a temp object
You clear ParamsFromPage
You add them back to ParamsFromPage
???
What are you doing?
Alexei Rodriguez
|
|
|
|
|
Actually I have paased this paramaters to a class object if you carefully examine the code and then I pass the paramaters to insert function of objectdatasource object. In back and there is a kist object what keep the all the values.
Thanks Alex.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
NewObj.Getyear = Int32.Parse(ParamsFromPage("GetYear")).ToString
NewObj.GetMonth = Int32.Parse(ParamsFromPage("GetMonth")).ToString
NewObj.GetDayFrom = Int32.Parse(ParamsFromPage("GetDayFrom")).ToString
NewObj.GetDayTo = Int32.Parse(ParamsFromPage("GetDayTo")).ToString
NewObj.GetStatus = ParamsFromPage("GetStatus").ToString
ParamsFromPage.Clear()
ParamsFromPage.Add("GetYear", NewObj.Getyear)
ParamsFromPage.Add("GetMonth", NewObj.GetMonth)
ParamsFromPage.Add("GetDayFrom", NewObj.GetDayFrom)
ParamsFromPage.Add("GetDayTo", NewObj.GetDayTo)
ParamsFromPage.Add("GetStatus", NewObj.GetStatus)
What are you doing here??
paramsFromPage has the same values that i had in the beggining
By the way...
If carefully look at this:
NewObj.GetDayTo = Int32.Parse(ParamsFromPage("GetDayTo")).ToString
I think that getDayTo expects an int32, you are making extra conversions, you case the value to int32 and then to string with the tostring method and then the result is casted back to int32 when you assign it
Alexei Rodriguez
|
|
|
|
|
You are right Alex. I forgot to take it out actually. Thanks
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Well, if you are 100% sure the name is correct (including the case) try executing the code at a later stage in the page's life cycle. Perhaps the control will not be null in page_preRender event.
I didn't get any requirements for the signature
|
|
|
|