When I use textbox they successfully working like this:
padd.txtCustomerName.Text = this.dtvContacts.CurrentRow.Cells[20].Value.ToString();
but how to apply in Radio Button.
padd.rbtLOI.Text = this.dtvContacts.CurrentRow.Cells[5].Value.ToString();
Try like this
if (this.dtvContacts.CurrentRow.Cells[5].Value.ToString() == "LOI")
{
padd.rbtLOI.Checked = true;
}
else
{
padd.rbtConfirmPO.Checked = true;
}
Related
I want to implement simple toggle functionality on a ToolStripButton.
View Mode --> Edit Mode
Edit Mode --> View Mode
This piece of code is working fine except that ToolTip doesn't refresh. I tried AutoToolTip property. I also tried setting ToolTipText to string.Empty. But my toolstrip continues to show old tooltip text. ToolTipText should also change when I toggle.
private void btnTrackingMode_Click(object sender, EventArgs e)
{
if (_currentSheetTrackingMode == SheetTrackingMode.ViewMode)
{
_currentTrackingMode = TrackingMode.EditMode;
btnTrackingMode.AutoToolTip = true;
btnTrackingMode.ToolTipText = string.Empty;
btnTrackingMode.ToolTipText = "You are currently in Edit Mode. Click here to enter into View Mode";
btnTrackingMode.Image = ((System.Drawing.Image) ((Image) new ComponentResourceManager(typeof(MyForm)).GetObject("btnTrackingEditMode.Image")));
btnTrackingMode.ImageTransparentColor = System.Drawing.Color.Magenta;
}
else
{
_currentTrackingMode = TrackingMode.ViewMode;
btnTrackingMode.AutoToolTip = true;
btnTrackingMode.ToolTipText = string.Empty;
btnTrackingMode.ToolTipText = "You are currently in View Mode. Click here to enter into Edit Mode";
btnTrackingMode.Image = ((System.Drawing.Image) ((Image) new ComponentResourceManager(typeof(MyForm)).GetObject("btnTrackingViewMode.Image")));
btnTrackingMode.ImageTransparentColor = System.Drawing.Color.Magenta;
}
}
You can try to refresh the button's parent ToolStrip
btnTrackingMode.ToolTipText = "something";
//put your toolstrip's name here
buttonsToolStrip.Refresh();
You should be able to access the parent tool strip through btnTrackingMode.Owner if it's not directly available for some reason.
I am trying to get a data from a password protected webpage using webbrowser , which uses a div container with 3 JQuery data fields. The 2nd field depends on the 1st one, and the 3rd one of the 2nd one.I need to set those 3 comboboxes and hit submit in order to get the data I want to scrape. The problem is that once the 1st combobox changes, it invokes a function which populates the 2nd and 3rd boxes. I can't figure out how to invoke this function...
This is how the first combobox looks like:
Select s[DCOM1] Selection1
I managed to set the 1st combobox, however the big problem that I have is to invoke viewStep.onSChanged() , which supposed to populate the 2nd box, I just can't make it work.
The onSChanged function is located in a Jquery js. file
self.onsChanged = function(selectadj) {
self.viewBasicsUpdated = true;
log.debug('onsChanged');
if (self.s) {
self.adjEnabled = false;
self.adj = null;
self.auctionType = 'S';
controller.ds.getadjList(self.s.id, function(response) {
controller.applyUpdates(function() {
self.adjList = response.data;
// Add "Add adj" option (as first in array).
self.adjList.unshift({
id : ADD_adj_ID,
fullName : controller.locale.getMessage('app.label.add.adj')
});
self.adjEnabled = true;
self.standardEnabled = true;
self.vixEnabled = (StringUtils.trimWS(self.s.vixFlag) === 'Y') ? true : false;
self.offsiteEnabled = (StringUtils.trimWS(self.s.offsiteFlag) === 'Y') ? true : false;
self.titOnlyEnabled = (StringUtils.trimWS(self.s.titOnlyFlag) === 'Y') ? true : false;
self.salType = self.s.salType;
self.titProcurementFlag = (StringUtils.trimWS(self.s.titProcurmentFlag) === 'Y') ? true : false;
//Selects the adj when a new adj is added.
if(selectadj){
angular.forEach(self.adjList, function(object, index) {
log.debug("object.id++"+object.id);
if(object.id===self.newadjId){
self.adj=object;
log.debug("self.newadjId++"+object.id);
}
});
}
});
});
}else{
controller.applyUpdates(function() {
self.adj = null;
self.adjEnabled = false;
self.auctionType = 'S';
self.standardEnabled = false;
self.vixEnabled = false;
self.offsiteEnabled = false;
self.titOnlyEnabled = false;
self.salType = null;
self.titProcurementFlag = false;
});`
}
};
I have tried to invoke the function in many different options including invokescript, posting an identical post request as the one I see with Fiddler (I guess it fails since the cookie is different) but everything fails. Is there a way to execute this function?
When setting values on input controls with Javascript the DOM events might not fire, depending on how the values are set.
Instead of trying to execute the very same function that the webpage would normally trigger, in this case self.onsChanged, fire the event on the control that you updated.
$("#selectBox1").val("Value A");
$("#selectBox1").change();
https://api.jquery.com/change/
I'm having a problem in interacting with a custom dropdown control. It works fine the 1st 6 times, but after that, since the screen is resized, it could no longer locate and click the option in the dropdown control, returning an exception - can't click on hidden control. I tried putting in a itemField.DrawHighlight(); on the control I'm looking for, and it finds it, however it can't click on it. I also tried a to scroll down, but it seems to be not working.
bool addItemCheck = false;
int scrollCheck = 0;
while (Check == false)
{
var addItem= new HtmlButton(window);
addItem.SearchProperties.Add(HtmlButton.PropertyNames.Id, "add-new-item");
Mouse.Click(addItem);
scrollCheck = scrollCheck + 1;
if (scrollCheck > 6)
{
Mouse.MoveScrollWheel(window, -100);
}
var itemDropDown = new HtmlSpan(window);
itemDropDown .SearchProperties.Add(HtmlSpan.PropertyNames.Class, "item-dropdown");
itemDropDown .SearchProperties.Add(HtmlSpan.PropertyNames.InnerText, "Select an Item");
Mouse.Click(itemDropDown );
addItemCheck = itemDropDown.Exists;
}
bool itemBoxCheck = false;
HtmlCustom itemBox = null;
while (itemBoxCheck == false)
{
itemBox = new HtmlCustom(window);
itemBox.SearchProperties.Add(HtmlCustom.PropertyNames.Id, "item-listbox");
var itemField = new HtmlCustom(itemBox);
itemField .SearchProperties.Add(HtmlCustom.PropertyNames.InnerText, item);
Mouse.Click(itemField);
itemBoxCheck = itemBox.Exists;
}
I would really appreciate any help. Thank you.
Try calling the method InsureClickable() on the control before attempting to click on it.
for example:
itemDropDown.EnsureClickable();
Mouse.Click(itemDropDown);
Edit:
if this doesn't work you'll have to scroll down to the item.
try using:
Mouse.MoveScrollWheel()
if that doesn't work also you'll have to map the scroll control and click on it.
I have a gridview that is bound to a sql database. As the user enters data they must indicate whether that cell's information is complete or not. To do this they enter /end/ at the end of their statement and it will automatically change the cell color. If nothing is entered then nothing happens.
Here is the code:
if (dataItem != null)
{
var label = dataItem["Status"].FindControl("Statuslbl") as Label;
if (label != null)
{
var item = dataItem;
var text = label.Text;
if (text.Contains("/end/"))
{
item["Status"].BackColor = Color.Lime;
item["Status"].Text = item["Status"].Text.Replace(#"/end/", #"");
}
else
{
item["Status"].BackColor = Color.Salmon;
}
}
}
Instead of just hiding the '/end/' like I need it to, it hides the entire cells contents.
How can I go about fixing this?
Discovered all I would need to do would be the following to achieve my result:
if (text.Contains("/end/"))
{
item["Test"].BackColor = Color.Lime;
item["Test"].Text = label.Text.Replace("/end/", " ");
}
Really simple, I just needed to use label.Text.
I have a table that is being use to hold link and image buttons that link the user to other pages on a web site. I want to hide some of these rows depending on the permission the use has. Right now I have:
// Disable buttons if user does not have admin security level
if (Session["SecurityLevel"] != "A")
{
linkbtnNewEmployee.Visible = false;
imgbtnNewEmployee.Visible = false;
linkbtnViewUserActivity.Visible = false;
imgbtnViewUserActivity.Visible = false;
linkbtnEditEmployees.Visible = false;
imgbtnEditEmployees.Visible = false;
linkbtnManageUsers.Visible = false;
imgbtnManageUsers.Visible = false;
}
which will hide the links and buttons, but the table rows still exist. So I have a row or 2 of space between links. I have tried naming rows and using the "rowToHide.style.display = 'none';" command which does not work because it will not recognize the row. The row id shows up in the source code fine, and I use the same ID in the command. Any suggestions? Thanks for your help!
In markup add an Id for the <tr> and runat="server" tag , like this:
<tr id="rowToHide" runat="server>
<!-- Contents here -->
</tr>
And in the code set the visible property to false, like this:
// Disable buttons if user does not have admin security level
if (Session["SecurityLevel"] != "A")
{
rowToHide.Visible = false;
linkbtnNewEmployee.Visible = false;
imgbtnNewEmployee.Visible = false;
linkbtnViewUserActivity.Visible = false;
imgbtnViewUserActivity.Visible = false;
linkbtnEditEmployees.Visible = false;
imgbtnEditEmployees.Visible = false;
linkbtnManageUsers.Visible = false;
imgbtnManageUsers.Visible = false;
}