My question i have a image in database, i want to retrieve and show in my home page , when i change menu , the image will be move through querystriing on the next menu. and i use the asp imagecontrol to hold the image in the master pasge
Can You show me step by step process from image retrieval from database to image show on pages..
can i make u understand?
Good Explaination will be highly appreciable
ramanujbasu
Can You show me step by step process from image retrieval from database to image show on pages..
Using the code below I am populating a drop down menu but the text does not line up. Is there a way so that when the drop down loads that the City part is all in line? Currently the city part can be more to left or more to the right depending on the length of the column before it? Thanks!
While reader.Read customers.Add(reader("Provider Last Name (Legal Name)").ToString + ", " + reader("Provider First Name").ToString + " " + reader("Provider Business Mailing Address City Name").ToString + ", " + reader("Provider Business Mailing Address State Name").ToString + " " + reader("Provider Business Mailing Address Postal Code").ToString)
End While
I've created some similar functionality in the past for aligning items within Dropdowns that leverages the empty character (ALT+255) to create spaces within drop-downs that are recognized within
It uses some of the available padding within the String formatting function to allocate exactly how many characters you want to use for a specific field and then has an additional function to replace those spaces with the "invisible character" :
string FormatForDropDown(string s, int length) { //Builds a string StringBuilder sb = new StringBuilder(); //Iterates through and replaces the empty values with the empty character (not a space) for (int i = 0; i < length; i++) { sb.Append((i < s.Length) ? s[i].ToString() : " "); } //Outputs the string return sb.ToString(); }
and as far as actually adding the actual entry, it should be used as such :
//Example of the item you would add to your Drop-down list String.Format("{0,24} | {1,12} | {2,24}", FormatForDropDown(valueA, 24), FormatForDropDown(valueB, 12), FormatForDropDown(valueC, 24));
(Warning : This is old code)
Since you are using Visual Basic, it may look something like this :
Public Function FormatForDropDown(ByVal s As String, ByVal length As Integer) As String Dim sb = New StringBuilder() For i As Integer = 0 To length sb.Append(If(i < s.Length, s(i).ToString(), " ")) Next Return sb.ToString() End Function
and
'String to Add' Dim entry = String.Format("{0,24} | {1,24} | {2,24} | {3,24} | {4, 24}",reader("Provider Last Name (Legal Name)").ToString(),reader("Provider Business Mailing Address City Name").ToString(), reader("Provider First Name").ToString(),reader("Provider Business Mailing Address State Name").ToString(), reader("Provider Business Mailing Address Postal Code").ToString() 'Add the entry' customers.Add(entry)
Alternatively, you could simply replace the strings of spaces that you are using with the invisible character " " as mentioned :
While reader.Read customers.Add(reader("Provider Last Name (Legal Name)").ToString() + ", " + reader("Provider First Name").ToString + " " + reader("Provider Business Mailing Address City Name").ToString() + ", " + reader("Provider Business Mailing Address State Name").ToString() + " " + reader("Provider Business Mailing Address Postal Code").ToString()) End While
I attempted to replace them in the code above however it may not have worked properly. It's just important to note that all of the spaces that you see above within your strings are not actual spaces but the invisible character (ALT+255).
Thanks, this seems to be close to what i need, proglem is some of the last names have a "-" so it throws off the alignment. Thanks for your help with this. Maybe can it be a set width so its like an excel sheet where its just like a straight line between with a set length?
JOHNSON | AJITA | BEAR | DE | 197013036
JOHNSON-Smith | AJITA | BEAR | DE | 197013036
Hi,
You are right. And please refer the similar thread
I frequently switch from Design View (in which for example I am visually editing something inside a FormView EditItemTemplate), to Source View.
Note that this happen when I am editing something inside a EditItemTemplate
So, for example if in Design View I have a TextBox selected, when I switch to Source View I'd like to have ONLY the corresponding lines selected, instead VS2010 highligh ALL the FormView EditItemtemplate code, from start to finish (which can be 1000 lines long!).
Is possible or not to instruct VS to select only the relevant lines?
No it is not posible.
Because gridview is one control and you are placing another controls inside it. So it is consider as part fo grid view so it will select whole grid view. And also you can not directly access that control in code behind just because of same reason.
Wait!
Now it is functioning correctly!
From Design view:
I select an TextBox --> ... is selected in source view
I click in a cell -->
I highligh a full table row in design --> the code inside
...
is selected in source, wonderful!
From source view:
I click wherever in a line inside
the whole table is highlighted in design view
I click inside a the control is highlighted in design view
WONDERFUL!!!
So, what the hell has got messed before, and what I have done in the meantime that reset things?
(In the meantime I have close and reopend VS (not working), rebuild solution, refactored code, reformatted code, changed formatting tag options, ecc...)
Arrghhh!!!
I edited the code from the Source view, removing a
line, the VS asked me to refresh the view, claiming that Design view is out of sync with Source view.
I clicked to synchronize view, and now it's not functioning anymore!!!
I thought it could be because some background VS task didn't have yet enough time to complete, so I waited ... but after something like 10 minutes of wait it's not working yet....
So, I clicked undo to insert the
lines back... and (not so surprisingly) the highlight works again!!!
What is happening???
PS: Important info. If instead I remove the
line from the Design view, via mouse dx popup menu-->Delete rows-->Delete row the Source/Design remains in synch and the highlight functionality continue working
Up to now I have found this workaround... that seems to be working :-)
You have manually edited the source code, so messing up the synchronize with design view...!
Select a control in Design view
Change something in the Properties window, (for example set width=100px, or toggle the Enabled property)
WAIT.... (your change forces VS to update the source code!)
After some time (something like 5-10 seconds for my slow machine ;-)), VS updates the code, adding/changing the relevant code
And now the bidirectional highlight functionality works again!
Remember to Change back/Toggle the modified property
My question i have a image in database, i want to retrieve and show in my home page , when i change menu , the image will be move through querystriing on the next menu. and i use the asp imagecontrol to hold the image in the master pasge
Can You show me step by step process from image retrieval from database to image show on pages..
can i make u understand?
Good Explaination will be highly appreciable
ramanujbasu
Can You show me step by step process from image retrieval from database to image show on pages..
Using the code below I am populating a drop down menu but the text does not line up. Is there a way so that when the drop down loads that the City part is all in line? Currently the city part can be more to left or more to the right depending on the length of the column before it? Thanks!
While reader.Read customers.Add(reader("Provider Last Name (Legal Name)").ToString + ", " + reader("Provider First Name").ToString + " " + reader("Provider Business Mailing Address City Name").ToString + ", " + reader("Provider Business Mailing Address State Name").ToString + " " + reader("Provider Business Mailing Address Postal Code").ToString)
End While
I've created some similar functionality in the past for aligning items within Dropdowns that leverages the empty character (ALT+255) to create spaces within drop-downs that are recognized within
It uses some of the available padding within the String formatting function to allocate exactly how many characters you want to use for a specific field and then has an additional function to replace those spaces with the "invisible character" :
string FormatForDropDown(string s, int length) { //Builds a string StringBuilder sb = new StringBuilder(); //Iterates through and replaces the empty values with the empty character (not a space) for (int i = 0; i < length; i++) { sb.Append((i < s.Length) ? s[i].ToString() : " "); } //Outputs the string return sb.ToString(); }
and as far as actually adding the actual entry, it should be used as such :
//Example of the item you would add to your Drop-down list String.Format("{0,24} | {1,12} | {2,24}", FormatForDropDown(valueA, 24), FormatForDropDown(valueB, 12), FormatForDropDown(valueC, 24));
(Warning : This is old code)
Since you are using Visual Basic, it may look something like this :
Public Function FormatForDropDown(ByVal s As String, ByVal length As Integer) As String Dim sb = New StringBuilder() For i As Integer = 0 To length sb.Append(If(i < s.Length, s(i).ToString(), " ")) Next Return sb.ToString() End Function
and
'String to Add' Dim entry = String.Format("{0,24} | {1,24} | {2,24} | {3,24} | {4, 24}",reader("Provider Last Name (Legal Name)").ToString(),reader("Provider Business Mailing Address City Name").ToString(), reader("Provider First Name").ToString(),reader("Provider Business Mailing Address State Name").ToString(), reader("Provider Business Mailing Address Postal Code").ToString() 'Add the entry' customers.Add(entry)
Alternatively, you could simply replace the strings of spaces that you are using with the invisible character " " as mentioned :
While reader.Read customers.Add(reader("Provider Last Name (Legal Name)").ToString() + ", " + reader("Provider First Name").ToString + " " + reader("Provider Business Mailing Address City Name").ToString() + ", " + reader("Provider Business Mailing Address State Name").ToString() + " " + reader("Provider Business Mailing Address Postal Code").ToString()) End While
I attempted to replace them in the code above however it may not have worked properly. It's just important to note that all of the spaces that you see above within your strings are not actual spaces but the invisible character (ALT+255).
Thanks, this seems to be close to what i need, proglem is some of the last names have a "-" so it throws off the alignment. Thanks for your help with this. Maybe can it be a set width so its like an excel sheet where its just like a straight line between with a set length?
JOHNSON | AJITA | BEAR | DE | 197013036
JOHNSON-Smith | AJITA | BEAR | DE | 197013036
Hi,
You are right. And please refer the similar thread
I frequently switch from Design View (in which for example I am visually editing something inside a FormView EditItemTemplate), to Source View.
Note that this happen when I am editing something inside a EditItemTemplate
So, for example if in Design View I have a TextBox selected, when I switch to Source View I'd like to have ONLY the corresponding lines selected, instead VS2010 highligh ALL the FormView EditItemtemplate code, from start to finish (which can be 1000 lines long!).
Is possible or not to instruct VS to select only the relevant lines?
No it is not posible.
Because gridview is one control and you are placing another controls inside it. So it is consider as part fo grid view so it will select whole grid view. And also you can not directly access that control in code behind just because of same reason.
Wait!
Now it is functioning correctly!
From Design view:
I select an TextBox --> ... is selected in source view
I click in a cell -->
I highligh a full table row in design --> the code inside
...
is selected in source, wonderful!
From source view:
I click wherever in a line inside
the whole table is highlighted in design view
I click inside a the control is highlighted in design view
WONDERFUL!!!
So, what the hell has got messed before, and what I have done in the meantime that reset things?
(In the meantime I have close and reopend VS (not working), rebuild solution, refactored code, reformatted code, changed formatting tag options, ecc...)
Arrghhh!!!
I edited the code from the Source view, removing a
line, the VS asked me to refresh the view, claiming that Design view is out of sync with Source view.
I clicked to synchronize view, and now it's not functioning anymore!!!
I thought it could be because some background VS task didn't have yet enough time to complete, so I waited ... but after something like 10 minutes of wait it's not working yet....
So, I clicked undo to insert the
lines back... and (not so surprisingly) the highlight works again!!!
What is happening???
PS: Important info. If instead I remove the
line from the Design view, via mouse dx popup menu-->Delete rows-->Delete row the Source/Design remains in synch and the highlight functionality continue working
Up to now I have found this workaround... that seems to be working :-)
You have manually edited the source code, so messing up the synchronize with design view...!
Select a control in Design view
Change something in the Properties window, (for example set width=100px, or toggle the Enabled property)
WAIT.... (your change forces VS to update the source code!)
After some time (something like 5-10 seconds for my slow machine ;-)), VS updates the code, adding/changing the relevant code
And now the bidirectional highlight functionality works again!
Remember to Change back/Toggle the modified property
Not able to either remove or hide(by setting the visible property) the child node. With the above code to remove node.ChildNodes.Remove(node) getting Collection is read only not supported exception.
Please help
Any help would be appreciated...
i think following line is problematic,
node.ChildNodes.Remove(node);
you are trying do delete node from node object, self-delete is not possible :)
instead try this
node.ChildNodes.RemoveAll(); OR node.ChildNodes.Clear();
Thanks.
ijaz_asp
instead try this
node.ChildNodes.RemoveAll(); OR node.ChildNodes.Clear();
same error "Collection is Read only" for node.ChildNodes.Clear(); Method Removeall(); does not exist at all
hmm, if this is the case , try to hide the item instead of deleting it. like if the data-bound item does not fullfill your display/visible logic then get it from template object and set its visibility to none or simply set visible=false.
thanks
I am able to set the Visible property (e.Item.Visible = false;) for the Parent node in ItemDataBound(object sender, RepeaterItemEventArgs e) but not able to hide the hyperlink which is dynamically created using repeater control.
Please help me with an example
it may be something like this,
var hyperlink = e.Item.findControl("ID of HyperLink") as HyperLink;
if(hyperlink !=null) { hyperlink.visible=false; // if it does not meet your criteria . }
thanks
These hyperlinks are dynamically generated in a repeater control. Not sure of the ID.
Not able to either remove or hide(by setting the visible property) the child node. With the above code to remove node.ChildNodes.Remove(node) getting Collection is read only not supported exception.
Please help
Any help would be appreciated...
i think following line is problematic,
node.ChildNodes.Remove(node);
you are trying do delete node from node object, self-delete is not possible :)
instead try this
node.ChildNodes.RemoveAll(); OR node.ChildNodes.Clear();
Thanks.
ijaz_asp
instead try this
node.ChildNodes.RemoveAll(); OR node.ChildNodes.Clear();
same error "Collection is Read only" for node.ChildNodes.Clear(); Method Removeall(); does not exist at all
hmm, if this is the case , try to hide the item instead of deleting it. like if the data-bound item does not fullfill your display/visible logic then get it from template object and set its visibility to none or simply set visible=false.
thanks
I am able to set the Visible property (e.Item.Visible = false;) for the Parent node in ItemDataBound(object sender, RepeaterItemEventArgs e) but not able to hide the hyperlink which is dynamically created using repeater control.
Please help me with an example
it may be something like this,
var hyperlink = e.Item.findControl("ID of HyperLink") as HyperLink;
if(hyperlink !=null) { hyperlink.visible=false; // if it does not meet your criteria . }
thanks
These hyperlinks are dynamically generated in a repeater control. Not sure of the ID.
Not able to either remove or hide(by setting the visible property) the child node. With the above code to remove node.ChildNodes.Remove(node) getting Collection is read only not supported exception.
Please help
Any help would be appreciated...
i think following line is problematic,
node.ChildNodes.Remove(node);
you are trying do delete node from node object, self-delete is not possible :)
instead try this
node.ChildNodes.RemoveAll(); OR node.ChildNodes.Clear();
Thanks.
ijaz_asp
instead try this
node.ChildNodes.RemoveAll(); OR node.ChildNodes.Clear();
same error "Collection is Read only" for node.ChildNodes.Clear(); Method Removeall(); does not exist at all
hmm, if this is the case , try to hide the item instead of deleting it. like if the data-bound item does not fullfill your display/visible logic then get it from template object and set its visibility to none or simply set visible=false.
thanks
I am able to set the Visible property (e.Item.Visible = false;) for the Parent node in ItemDataBound(object sender, RepeaterItemEventArgs e) but not able to hide the hyperlink which is dynamically created using repeater control.
Please help me with an example
it may be something like this,
var hyperlink = e.Item.findControl("ID of HyperLink") as HyperLink;
if(hyperlink !=null) { hyperlink.visible=false; // if it does not meet your criteria . }
thanks
These hyperlinks are dynamically generated in a repeater control. Not sure of the ID.
Not able to either remove or hide(by setting the visible property) the child node. With the above code to remove node.ChildNodes.Remove(node) getting Collection is read only not supported exception.
Please help
Any help would be appreciated...
i think following line is problematic,
node.ChildNodes.Remove(node);
you are trying do delete node from node object, self-delete is not possible :)
instead try this
node.ChildNodes.RemoveAll(); OR node.ChildNodes.Clear();
Thanks.
ijaz_asp
instead try this
node.ChildNodes.RemoveAll(); OR node.ChildNodes.Clear();
same error "Collection is Read only" for node.ChildNodes.Clear(); Method Removeall(); does not exist at all
hmm, if this is the case , try to hide the item instead of deleting it. like if the data-bound item does not fullfill your display/visible logic then get it from template object and set its visibility to none or simply set visible=false.
thanks
I am able to set the Visible property (e.Item.Visible = false;) for the Parent node in ItemDataBound(object sender, RepeaterItemEventArgs e) but not able to hide the hyperlink which is dynamically created using repeater control.
Please help me with an example
it may be something like this,
var hyperlink = e.Item.findControl("ID of HyperLink") as HyperLink;
if(hyperlink !=null) { hyperlink.visible=false; // if it does not meet your criteria . }
thanks
These hyperlinks are dynamically generated in a repeater control. Not sure of the ID.
Not able to either remove or hide(by setting the visible property) the child node. With the above code to remove node.ChildNodes.Remove(node) getting Collection is read only not supported exception.
Please help
Any help would be appreciated...
i think following line is problematic,
node.ChildNodes.Remove(node);
you are trying do delete node from node object, self-delete is not possible :)
instead try this
node.ChildNodes.RemoveAll(); OR node.ChildNodes.Clear();
Thanks.
ijaz_asp
instead try this
node.ChildNodes.RemoveAll(); OR node.ChildNodes.Clear();
same error "Collection is Read only" for node.ChildNodes.Clear(); Method Removeall(); does not exist at all
hmm, if this is the case , try to hide the item instead of deleting it. like if the data-bound item does not fullfill your display/visible logic then get it from template object and set its visibility to none or simply set visible=false.
thanks
I am able to set the Visible property (e.Item.Visible = false;) for the Parent node in ItemDataBound(object sender, RepeaterItemEventArgs e) but not able to hide the hyperlink which is dynamically created using repeater control.
Please help me with an example
it may be something like this,
var hyperlink = e.Item.findControl("ID of HyperLink") as HyperLink;
if(hyperlink !=null) { hyperlink.visible=false; // if it does not meet your criteria . }
thanks
These hyperlinks are dynamically generated in a repeater control. Not sure of the ID.