.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to check field is exits in XSLT?

Posted By:      Posted Date: September 18, 2010    Points: 0   Category :ASP.Net
HI,I have below XML which i am transforming into XSLT vai asp.net, How i can detect if particular name is exits in xml file?<fld id="txt1"  title="Text 1" dbfield="name1" /><fld id="txt2"  title="Text 2"  />I am trying to know how i can know if dbfield is exits or not.Below i i tried but giving error.<xsl:choose> <xsl:when test="count(@dbfield)>0"> <xsl:variable name="dbfname"> <xsl:value-of select="@dbfield"/></xsl:variable></xsl:when> <xsl:otherwise> <xsl:variable name="dbfname">0</xsl:variable> </xsl:otherwise> </xsl:choose>Thank You

View Complete Post

More Related Resource Links

Displaying Date Field Base On Check Box Equal To Yes

In WSS 3.0 I am trying to display a date field on a form if a user selects (checks yes) in a check box field

Binding values to text box field in xslt page


Hi i have the SQLite data table which i have coverted to an xml page. for this xml page i'm using xslt to display page. in this xslt page i have a table similar to that Sqlite table but in each <td></td> i have inserted a text box so that it can be editable and updatable like

<td> <input id="TextBoxlocalMarkup" type="text" class="text1" disabled="disabled"></input> </td>

<td> <input id="TextBoxLocalSurcharge" type="text" class="text1" disabled="disabled"/> </td> 

i want to display the values in these text boxes... How can i do that in xslt for-each loop

Get Page Layout to check whether a field is filled in and display

I have a page layout that has a URL Field which users can fill in, if needed.  The field is:
<SharePointWebControls:UrlField FieldName="DetailedInformation" InputFieldLabel="Link to Plan Change page" runat="server"/>

This field lives in the Edit Mode Panel but I need to display it within the page, if the user fills it in.

The only way I know how to display fields throughout a text of the page, is to use the FieldValue, e.g.

<SharePointWebControls:FieldValue FieldName="DetailedInformation" runat="server"></SharePointWebControls:FieldValue>

Is there a way to say "if the above field is not null, then display with formatting as below" - similar to an If statement.

<p class="ms-rteCustom-hyperlink-arrow">
	<SharePointWebControls:FieldValue FieldName="DetailedInformation" runat="server"></SharePointWebControls:FieldValue>

If I put the above code and the field isn't filled in, the arrow (from the class) will display but I do not want it to.

Please note that I am using SharePoint Designer 2007 to create the page layout.

How to check if a certain XML field data already exists in a table?



Let's say I have a table like this:

ID int

Data XML


When I insert, I want:

if(not exists(select 1 from MyTable where Data = @MyXMLString))

  insert into MyTable(Data) values(@MyXMLString)

The problem is, Data = @MyXMLString does not work because Data is XML, @MyXMLString is varchar. So, how should I do this?


Using a CompareValidator to check input is a valid date

The CompareValidator can do more than just compare two controls. You can also compare it against several of the main .net data types such as Date, Integer, Double and Currency.

To do this you would set Operator="DataTypeCheck" and instead of setting the ControlToCompare or ValueToCompare attributes as you normally would you use the Type="Date" (or any of the data types I have listed above).

Check All with JQuery and a Asp.Net GridView

Display a Grid on the screen with a checkbox in each row. At the bottom of the page have "Check All" button.

Typically if I need to do anything interesting I use a template column. So my GridView will look like the one below (most other columns removed for readability). The only interesting point to note is the CssClass="ApprovalCheckBox" in the CheckBox ItemTemplate.

calculation, field and map traverse adjustment, and coordinate transformation

Free Pocket PC land surveying software -- COGO calculation, field and map traverse adjustment, and coordinate transformation -- for students and professionals.

check box control


Hi ,

I have a three check box in my web form ,i need to choose only one check box, if i choose one check box

another 2 check box automatically unchecked

can i use jquery for check box

I thought this would be simple... Trying to create a login does an ajax check before submit


I have the standard .net login control that is working.  (Still learning .net after 15yrs of classic)

What I want to do is OnButtonClick run a javascript function (to do an ajax call to the db to check if login is valid or not) and if it returns true, then submit the form normally, else don't submit. The piece that I can't figure out, is how to correctly override the default click even to hit my JS routine and then submit the form properly afterwards.

Thanks ahead of time

Dropdown Event (Template Field)



I have grid view control that includes a dropdown control in a template field.

I wish to execute some code when the value is changed in the dropdown list.  Can't figure out how to capture this event though?

Any suggestions?

How to take value of bound field of grid in a variable or in a textbox.


How to take value of bound field of grid in a variable or in a textbox.

 I m using this code in .aspx page for grid.

<asp:GridView ID="Grd_Mprocess" runat="server" AutoGenerateColumns="False"

                      Width="100%" AllowPaging="True"


                      AllowSorting="True" PageSize="5"  >

                 <RowStyle CssClass="odd" />


<asp:BoundField HeaderText="DOC_TYPE_PK" DataField="DOC_TYPE_PK"  Visible="true" >


  <asp:TemplateField HeaderText="DOC TYPE ID" Visible="true">  &nbs

how to check a textbox value in jquery?



I want to perform some action when an asp.net textbox value length is greater than 1 character. And for this I wanted to know how to write this check in jquery?

I have created a check like below-

if ($('[id=txtUserInput]').val().length > 2)
{ do some work...} 

But its giving me the following error

$("[id=txtUserInput]").val() is undefined

Can anybody let me know the right way of doing this?



How to check for null/empty strings on dynamic objects?


What is the proper way to check for null or empty strings on dynamic objects? This is the only solution I've found so far:

if (admin.PasswordHash.GetType() == typeof(DBNull) || admin.PasswordHash == string.Empty)

If the field is null, the object returned is DBNull.Value, but if the field is empty string, it's return as a System.String object. This makes it impossible to do regular "admin.PasswordHash == DBNull.Value" check, as that will fail whenever the field has been set to empty string. Is my example the right (and only) way to go?

Automatically redirect to HTTPS and check if SSL is active



I've set in the web.config:

    <!-- User Authentication -->
    <authentication mode="Forms">
      <forms loginUrl="~/Page/View/Content/Login.aspx" timeout="2880" requireSSL="true" />

This works fine. If there is no ssl connection, the login form doesn't continue. But I would like to check if ssl is active (in codebehind) and, if it's possible, to automatically the user to the https page if he's currently on http. (I could do this job by manually redirect with page.response("https://url.../login.aspx"); but this is not really generic. For example if the webapp is moved to another domain it doesn't work anymore... I'm looking for something like: FormsAuthentication.RedirectWithSSL(); or so... :D)


how to check which pages of my site that my visitor visiting at the moment


 Hi all, and thanks a lot for the replies since now. I have a new question :

I prepared a simple instant messaging system for my web site and i would like to learn which visitor (registered member) is at which page of my site. 

For example : 

Uid:10000, Username:donald, NameSurname:Donald DUCK is a registered and signed in visitor.

I need the code which tells me that visitor is at which page (ie. images.aspx?imageid=143223)

Sorry for my poor english, and let me know if i should explain more clearly :)

Have a good evening...

I need help about nvarchar field



how can specified nvarchar data type without N''?

adding XML 'records' with a key field


I have a vb.net Sub that is successfully adding 'records' to my XML file:

Private Sub btnSubmit_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnSubmit.Click             'for adding an XML 'record'
        Using ds As New DataSet()
            Dim dr As DataRow = ds.Tables(0).NewRow()
            dr("subject") = txtNewEvent.Text
            dr("year") = DateTime.Now.ToString("MM/dd/yy")
            txtNewEvent.Text = ""

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend