如何通过从asp.net中的单选按钮列表中选择插入文本框值到sql中 [英] how to insert textbox values by selecting from radiobutton list in asp.net into sql

查看:78
本文介绍了如何通过从asp.net中的单选按钮列表中选择插入文本框值到sql中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从选择单选按钮列表项中插入文本框值.假设我有3个文本框,我想从单选按钮列表项中选择1个文本框并将其值插入sql.plz,请帮助我.

i want to insert textbox values from choosing radiobutton list items.suppose i have 3 textbox, i want to select 1 of them from radiobutton list items and insert its value into sql.plz help me.

推荐答案

/ Only allows numeric values
function isNumeric(num){
    var charCode = (num.which) ? num.which : event.keyCode;
    if (charCode > 31 && (charCode < 48 || charCode > 57)) { return false; }
    else { return true; }
}

// Validates TextBox Length
function validateTextBoxLength() {
    var tb = document.getElementById("TextBox1").value;
    if (tb.length > 1 && tb.length != 4) {
        alert("TextBox must be 4 digits.");
        return false;
    }
    return true;
}

// Check for RadioButtonList selection
function rbSelectedValue() {
    var radio = document.getElementsByName('<%= rblSearchType.ClientID %>');
    var tb = document.getElementById("TextBox1").value;
    for (var i = 0; i < radio.length; i++) {
        if (radio[i].checked) {
            // alert("RadioButton 1 Selected");
            if (tb.length > 1 && tb.length != 4) {
                alert("TextBox must be 4 digits.");
                return false;
            }
            else {
            return true;
            }
        }
        else {
        // alert("RadioButton 2 Selected");
        return true;
    }
}


这篇关于如何通过从asp.net中的单选按钮列表中选择插入文本框值到sql中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆