需要文本保存到数据库中大写 [英] Need to save text to database in uppercase

查看:256
本文介绍了需要文本保存到数据库中大写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用一个FormView并根据需要C#code一个asp页面4.0。我对街道名称文本框添加/编辑。我已经使用CSS文本转换:大写,它把看的输入文本但是为大写的基础文本是在打字时使用的情况。我需要的文本保存在我的SQL数据库为大写。

我已经打了对没有运气后端各种形式的FindControl的。我可以指定一个新的变量和文本框中的文本填充然后更改变量转换为大写字母(.ToUpper),但是我不能确定如何将变量写回文本字段中。

我希望有人知道我在说什么,因为我已经找到了人想在上面文本框中的文本很多情况,但没有发现任何的文本保存到数据库中全部大写之中。

下面是code:

 < HTML的xmlns =htt​​p://www.w3.org/1999/xhtml>
    <头=服务器>
    <标题>官优势< /标题>
    <风格类型=文/ CSS>
        .UpperCaseTextField
            {
                文本转换:大写;
            }
    < /风格>
        <链接rel =快捷方式图标的href =〜/基址/ favicon.ico的TYPE =图像/ X-图标/>
        <链接rel =图标的href =〜/基址/ favicon.ico的TYPE =图像/ X-图标/>
    < /头>
    <车身风格=背景色:白色>
    <表ID =StreetFrm=服务器的onload =LoadStreetRecords>
    < ASP:表ID =HeaderTbl=服务器Horizo​​ntalAlign =中心WIDTH =800像素FONT-名称=sans-衬线>
        < ASP:的TableRow ID =HeaderRow_1=服务器WIDTH =800像素Horizo​​ntalAlign =中心VerticalAlign =评出的>
            < ASP:TableCell的ID =HeaderCellLeft=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =250像素ROWSPAN =2>< ASP:ImageButton的ID =MemberStreetOfficerAdvantageBtnRUNAT =服务器的ImageUrl =〜/基址/ OA_Logo.png一项PostBackUrl =〜/ OA467 / Default.aspx的/>< / ASP:TableCell的>
            < ASP:TableCell的ID =HeaderCellMiddle=服务器Horizo​​ntalAlign =中心VerticalAlign =评出的WIDTH =300像素ROWSPAN =2>< ASP:ImageButton的ID =StreetHeaderLogoRUNAT =服务器的ImageUrl =〜/基址/ Streets_Header.png/>< / ASP:TableCell的>
            < ASP:TableCell的ID =HeaderCellRight=服务器Horizo​​ntalAlign =右VerticalAlign =评出的WIDTH =250像素>< ASP:标签ID =HeaderDayDateLab=服务器字体粗体=真FONT-SIZE =中前景色=#00AEEF文本=标签>< / ASP:标签>< / ASP:TableCell的>
        < / ASP:&的TableRow GT;
        < ASP:的TableRow ID =HeaderRow_2=服务器WIDTH =800像素Horizo​​ntalAlign =右VerticalAlign =评出的>
            < ASP:TableCell的ID =HeaderRow2Col3=服务器Horizo​​ntalAlign =右VerticalAlign =底部WIDTH =250像素>< ASP:标签ID =HeaderLoginStatus=服务器字体粗体=真FONT-SIZE =中前景色=#00AEEF文本=访客>< / ASP:标签>< / ASP:TableCell的>
        < / ASP:&的TableRow GT;
        < ASP:的TableRow ID =HeaderRow_3=服务器HEIGHT =20像素WIDTH =800像素Horizo​​ntalAlign =中心VerticalAlign =评出的>
            < ASP:TableCell的ID =开发的Celltop=服务器背景色=#00AEEFHEIGHT =10px的Horizo​​ntalAlign =中心VerticalAlign =评出的WIDTH =800像素ColumnSpan =3>< / ASP:TableCell的>
        < / ASP:&的TableRow GT;
    < / ASP:表>
    < ASP:表ID =StreetTbl_1=服务器Horizo​​ntalAlign =中心WIDTH =800像素FONT-名称=无衬线>
        < ASP:的TableRow ID =StreetTbl_1_Row_1=服务器VerticalAlign =评出的WIDTH =800像素>
            < ASP:TableCell的ID =StreetTbl_1_Row_1_Cell_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =250像素>
                < ASP:表ID =StreetTbl_2=服务器Horizo​​ntalAlign =中心WIDTH =250像素>
                    < ASP:的TableRow ID =StreetTbl_2_Row_1=服务器VerticalAlign =评出的WIDTH =250像素>
                        < ASP:TableCell的ID =StreetTbl_2_Row_1_Cell_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =250像素>
                             < ASP:标签ID =StreetSelectLab=服务器FONT-粗体=FALSEFONT-SIZE =中前景色=#00AEEF文本=SELECT STREET>< / ASP:标签>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                    < ASP:的TableRow ID =StreetTbl_2_Row_2=服务器VerticalAlign =评出的WIDTH =250像素>
                        < ASP:TableCell的ID =StreetTbl_2_Row_2_Cell_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =250像素ROWSPAN =2>
                            < ASP:列表框ID =StreetSelectLbx=服务器的AutoPostBack =真的DataSourceID =StreetDataSource1DataTextField =StreetNameDataValueField =IDHEIGHT =425pxWIDTH =240像素字体粗体=真正的FONT-SIZE =中前景色=#2E3192OnSelectedIndexChanged =StreetSelectLbx_SelectedIndexChanged>< / ASP:列表框>
                            < ASP:SqlDataSource的ID =StreetDataSource1=服务器的ConnectionString =<%$的ConnectionStrings:OA_ConnectionString%>中的SelectCommand =SELECT * FROM [streetTbl] ORDER BY StreetName>< / ASP:SqlDataSource的>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                < / ASP:表>
            < / ASP:TableCell的>
            < ASP:TableCell的ID =StreetTbl_1_Row_1_Cell_2=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550px>
                < ASP:FormView控件ID =StreetDetailsFvu=服务器的DataKeyNames =ID的DataSourceID =StreetDataSource2DefaultMode =只读OnItemUpdated =StreetDetailsFvu_ItemUpdatedOnItemInserted =StreetDetailsFvu_ItemInserted>
                <&ItemTemplate中GT;
                < ASP:表ID =StreetTbl_3=服务器Horizo​​ntalAlign =左WIDTH =550px>
                    < ASP:的TableRow ID =StreetTbl_3_Row_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550px>
                        < ASP:TableCell的ID =StreetTbl_3_Row_1_Cell_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550pxColumnSpan =3>
                            < ASP:标签ID =StreetLab=服务器FONT-粗体=FALSEFONT-SIZE =中前景色=#00AEEF文本=街道名称>< / ASP:标签>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                    < ASP:的TableRow ID =StreetTbl_3_Row_2=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550px>
                        < ASP:TableCell的ID =StreetTbl_3_Row_2_Cell_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550pxColumnSpan =3>
                            < ASP:文本框ID =StreetTxt=服务器FONT-粗体=真FONT-SIZE =中前景色=#2E3192WIDTH =540px文本='<%#的eval( StreetName)%>'的CssClass =UpperCaseTextField>< / ASP:文本框>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                    < ASP:的TableRow ID =StreetsTbl_3_Row_3=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550px>
                        < ASP:TableCell的ID =StreetTbl_3_Row_3_Cell_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =60像素>
                            < ASP:标签ID =StreetStateLab=服务器FONT-粗体=FALSEFONT-SIZE =中前景色=#00AEEFWIDTH =55像素文本=STATE>< / ASP:标签>
                        < / ASP:TableCell的>
                        < ASP:TableCell的ID =StreetTbl_3_Row_3_Cell_2=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =245px>
                            < ASP:标签ID =StreetCountyLab=服务器FONT-粗体=FALSEFONT-SIZE =中前景色=#00AEEFWIDTH =235px文本=县>< / ASP:标签>
                        < / ASP:TableCell的>
                        < ASP:TableCell的ID =StreetTbl_3_Row_3_Cell_3=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =245px>
                            < ASP:标签ID =StreetCityLab=服务器FONT-粗体=FALSEFONT-SIZE =中前景色=#00AEEFWIDTH =230px文本=CITY>< / ASP:标签>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                    < ASP:的TableRow ID =StreetsTbl_3_Row_4=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550px>
                        < ASP:TableCell的ID =StreetTbl_3_Row_4_Cell_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =60像素>
                            < ASP:文本框ID =StreetStateTxt=服务器FONT-粗体=真FONT-SIZE =中前景色=#2E3192WIDTH =55像素文本='<%#的eval( StreetState)%>'>< / ASP:文本框>
                        < / ASP:TableCell的>
                        < ASP:TableCell的ID =StreetTbl_3_Row_4_Cell_2=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =245px>
                            < ASP:文本框ID =StreetCountyTxt=服务器FONT-粗体=真FONT-SIZE =中前景色=#2E3192WIDTH =235px文本='<%#的eval( StreetCounty)%>'>< / ASP:文本框>
                        < / ASP:TableCell的>
                        < ASP:TableCell的ID =StreetTbl_3_Row_4_Cell_3=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =245px>
                            < ASP:文本框ID =StreetCityTxt=服务器FONT-粗体=真FONT-SIZE =中前景色=#2E3192WIDTH =230px文本='<%#的eval( StreetCity)%>'>< / ASP:文本框>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                     < ASP:的TableRow ID =TableRow1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550px>
                        < ASP:TableCell的ID =TableCell2=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550pxColumnSpan =3>
                            < BR />
                            < ASP:标签ID =Label1的=服务器FONT-粗体=FALSEFONT-SIZE =中前景色=#00AEEF文本=行动记录下来,>< / ASP:标签>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                    < ASP:的TableRow ID =StreetTbl_3_Row_5=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550px>
                        < ASP:TableCell的ID =StreetTbl_3_Row_5_Cell_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550pxColumnSpan =3>
                            < ASP:ImageButton的ID =StreetActionsEditBtn=服务器的CausesValidation =真的OnClick =FormViewChangeToEditMode的ImageUrl =〜/基址/ Edit.png/>
                            &安培; NBSP;
                            < ASP:ImageButton的ID =StreetActionsInsertBtn=服务器的CausesValidation =真的OnClick =FormViewChangeToInsertMode的ImageUrl =〜/基址/ New.png/>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                < / ASP:表>
                < / ItemTemplate中>
                <&EditItemTemplate的GT;
                < ASP:表ID =StreetTbl_3=服务器Horizo​​ntalAlign =左WIDTH =550px>
                    < ASP:的TableRow ID =StreetTbl_3_Row_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550px>
                        < ASP:TableCell的ID =StreetTbl_3_Row_1_Cell_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550pxColumnSpan =3>
                            < ASP:标签ID =StreetLab=服务器FONT-粗体=FALSEFONT-SIZE =中前景色=#00AEEF文本=街道名称>< / ASP:标签>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                    < ASP:的TableRow ID =StreetTbl_3_Row_2=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550px>
                        < ASP:TableCell的ID =StreetTbl_3_Row_2_Cell_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550pxColumnSpan =3>
                            < ASP:文本框ID =StreetTxt=服务器FONT-粗体=真FONT-SIZE =中前景色=#2E3192WIDTH =540px文本='<%#绑定( StreetName)%>'的CssClass =UpperCaseTextField>< / ASP:文本框>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                    < ASP:的TableRow ID =StreetsTbl_3_Row_3=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550px>
                        < ASP:TableCell的ID =StreetTbl_3_Row_3_Cell_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =60像素>
                            < ASP:标签ID =StreetStateLab=服务器FONT-粗体=FALSEFONT-SIZE =中前景色=#00AEEFWIDTH =55像素文本=STATE>< / ASP:标签>
                        < / ASP:TableCell的>
                        < ASP:TableCell的ID =StreetTbl_3_Row_3_Cell_2=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =245px>
                            < ASP:标签ID =StreetCountyLab=服务器FONT-粗体=FALSEFONT-SIZE =中前景色=#00AEEFWIDTH =235px文本=县>< / ASP:标签>
                        < / ASP:TableCell的>
                        < ASP:TableCell的ID =StreetTbl_3_Row_3_Cell_3=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =245px>
                            < ASP:标签ID =StreetCityLab=服务器FONT-粗体=FALSEFONT-SIZE =中前景色=#00AEEFWIDTH =230px文本=CITY>< / ASP:标签>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                    < ASP:的TableRow ID =StreetsTbl_3_Row_4=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550px>
                        < ASP:TableCell的ID =StreetTbl_3_Row_4_Cell_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =60像素>
                            < ASP:文本框ID =StreetStateTxt=服务器FONT-粗体=真FONT-SIZE =中前景色=#2E3192WIDTH =55像素文本='<%#绑定( StreetState)%>'>< / ASP:文本框>
                        < / ASP:TableCell的>
                        < ASP:TableCell的ID =StreetTbl_3_Row_4_Cell_2=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =245px>
                            < ASP:文本框ID =StreetCountyTxt=服务器FONT-粗体=真FONT-SIZE =中前景色=#2E3192WIDTH =235px文本='<%#绑定( StreetCounty)%>'>< / ASP:文本框>
                        < / ASP:TableCell的>
                        < ASP:TableCell的ID =StreetTbl_3_Row_4_Cell_3=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =245px>
                            < ASP:文本框ID =StreetCityTxt=服务器FONT-粗体=真FONT-SIZE =中前景色=#2E3192WIDTH =230px文本='<%#绑定( StreetCity)%>'>< / ASP:文本框>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                    < ASP:的TableRow ID =TableRow1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550px>
                        < ASP:TableCell的ID =TableCell2=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550pxColumnSpan =3>
                            < BR />
                            < ASP:标签ID =Label1的=服务器FONT-粗体=FALSEFONT-SIZE =中前景色=#00AEEF文本=行动记录下来,>< / ASP:标签>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                    < ASP:的TableRow ID =StreetTbl_3_Row_5=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550px>
                        < ASP:TableCell的ID =StreetTbl_3_Row_5_Cell_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550pxColumnSpan =3>
                            < ASP:ImageButton的ID =StreetActionsSaveBtn=服务器的CausesValidation =真的CommandName =更新的ImageUrl =〜/基址/ Save.png/>
                            &安培; NBSP;
                            < ASP:ImageButton的ID =StreetActionsCancelBtn=服务器的CausesValidation =真的OnClick =FormViewChangeToItemMode的ImageUrl =〜/基址/ Cancel.png/>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                < / ASP:表>
                < / EditItemTemplate中>
                <&InsertTemplate则GT;
                < ASP:表ID =StreetTbl_3=服务器Horizo​​ntalAlign =左WIDTH =550px>
                    < ASP:的TableRow ID =StreetTbl_3_Row_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550px>
                        < ASP:TableCell的ID =StreetTbl_3_Row_1_Cell_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550pxColumnSpan =3>
                            < ASP:标签ID =StreetLab=服务器FONT-粗体=FALSEFONT-SIZE =中前景色=#00AEEF文本=街道名称>< / ASP:标签>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                    < ASP:的TableRow ID =StreetTbl_3_Row_2=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550px>
                        < ASP:TableCell的ID =StreetTbl_3_Row_3_Cell_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550pxColumnSpan =3>
                            < ASP:文本框ID =StreetTxt=服务器FONT-粗体=真FONT-SIZE =中前景色=#2E3192WIDTH =540px文本='<%#绑定( StreetName)%>'的CssClass =UpperCaseTextField>< / ASP:文本框>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                    < ASP:的TableRow ID =StreetsTbl_3_Row_3=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550px>
                        < ASP:TableCell的ID =TableCell1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =60像素>
                            < ASP:标签ID =StreetStateLab=服务器FONT-粗体=FALSEFONT-SIZE =中前景色=#00AEEFWIDTH =55像素文本=STATE>< / ASP:标签>
                        < / ASP:TableCell的>
                        < ASP:TableCell的ID =StreetTbl_3_Row_3_Cell_2=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =245px>
                            < ASP:标签ID =StreetCountyLab=服务器FONT-粗体=FALSEFONT-SIZE =中前景色=#00AEEFWIDTH =235px文本=县>< / ASP:标签>
                        < / ASP:TableCell的>
                        < ASP:TableCell的ID =StreetTbl_3_Row_3_Cell_3=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =245px>
                            < ASP:标签ID =StreetCityLab=服务器FONT-粗体=FALSEFONT-SIZE =中前景色=#00AEEFWIDTH =230px文本=CITY>< / ASP:标签>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                    < ASP:的TableRow ID =StreetsTbl_3_Row_4=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550px>
                        < ASP:TableCell的ID =StreetTbl_3_Row_4_Cell_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =60像素>
                            < ASP:列表框ID =StreetStateLbx=服务器FONT-粗体=真FONT-SIZE =中前景色=#2E3192WIDTH =55像素HEIGHT =298DataValueField ='StateAbbreviation的DataSourceID =StreetDataSourceDataTextField =StateAbbreviation的SelectedValue ='<%#绑定(StreetState)%>'>< / ASP:列表框>
                        < / ASP:TableCell的>
                        < ASP:TableCell的ID =StreetTbl_3_Row_4_Cell_2=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =245px>
                            < ASP:列表框ID =CountyLbx=服务器FONT-粗体=真FONT-SIZE =中前景色=#2E3192WIDTH =235pxHEIGHT =298DataValueField ='CountyName的DataSourceID =CountyDataSourceDataTextField =CountyName的SelectedValue ='<%#绑定(StreetCounty)%>'>< / ASP:列表框>
                        < / ASP:TableCell的>
                        < ASP:TableCell的ID =StreetTbl_3_Row_4_Cell_3=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =245px>
                            < ASP:列表框ID =StreetCityTxt=服务器FONT-粗体=真FONT-SIZE =中前景色=#2E3192WIDTH =230pxHEIGHT =298DataValueField ='CITYNAME的DataSourceID =CityDataSourceDataTextField =CITYNAME的SelectedValue ='<%#绑定(StreetCity)%>'>< / ASP:列表框>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                    < ASP:的TableRow ID =TableRow1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550px>
                        < ASP:TableCell的ID =TableCell2=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550pxColumnSpan =3>
                            < BR />
                            < ASP:标签ID =Label1的=服务器FONT-粗体=FALSEFONT-SIZE =中前景色=#00AEEF文本=行动记录下来,>< / ASP:标签>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                    < ASP:的TableRow ID =StreetTbl_3_Row_5=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550px>
                        < ASP:TableCell的ID =StreetTbl_3_Row_5_Cell_1=服务器Horizo​​ntalAlign =左VerticalAlign =评出的WIDTH =550pxColumnSpan =3>
                            < ASP:ImageButton的ID =StreetActionsInsertBtn=服务器的CausesValidation =真OnDisposed =FormViewChangeToEditMode的CommandName =插入的ImageUrl =〜/基址/ Save.png/>
                            &安培; NBSP;
                            < ASP:ImageButton的ID =StreetActionsCancelBtn=服务器的CausesValidation =真OnDisposed =FormViewChangeToEditMode的CommandName =取消的ImageUrl =〜/基址/ Cancel.png/>
                        < / ASP:TableCell的>
                    < / ASP:&的TableRow GT;
                < / ASP:表>
                < / InsertTemplate则>
                < / ASP:FormView控件>
            < / ASP:TableCell的>
        < / ASP:&的TableRow GT;
    < / ASP:表>
        < ASP:SqlDataSource的ID =StreetDataSource2=服务器的ConnectionString =<%$的ConnectionStrings:OA_ConnectionString%>中的SelectCommand =SELECT * FROM [StreetTbl] WHERE([ID] = @ID)的UpdateCommand =更新[StreetTbl]设置[Streetname] = @StreetName,[StreetState] = @StreetState,[StreetCounty] = @StreetCounty,[StreetCity ] = @StreetCity其中[ID] = @ID的InsertCommand =INSERT INTO [streetTbl]([StreetName],[StreetState],[StreetCounty],[StreetCity])VALUES(@StreetName,@StreetState,@StreetCounty,@StreetCity )>
            < SelectParameters>
                < ASP:ControlParameter控件ID =StreetSelectLbx默认值=42NAME =ID属性名=的SelectedValueTYPE =的Int32/>
            < / SelectParameters>
            < UpdateParameters>
                < ASP:参数名称=ID类型=的Int32/>
                < ASP:参数名称=StreetName类型=字符串/>
            < / UpdateParameters>
            < InsertParameters>
                < ASP:参数名称=ID类型=的Int32/>
                < ASP:参数名称=StreetName类型=字符串/>
            < / InsertParameters>
            < D​​eleteParameters>
            < / DeleteParameters>
        < / ASP:SqlDataSource的>
        < ASP:SqlDataSource的ID =StreetDataSource=服务器的ConnectionString =<%$的ConnectionStrings:OA_ConnectionSTring%>中的SelectCommand =SELECT * FROM [statesTbl] ORDER BY StateAbbreviation>
        < / ASP:SqlDataSource的>
        < ASP:SqlDataSource的ID =CountyDataSource=服务器的ConnectionString =<%$的ConnectionStrings:OA_ConnectionSTring%>中的SelectCommand =SELECT * FROM [countyTbl] ORDER BY CountyName>
        < / ASP:SqlDataSource的>
        < ASP:SqlDataSource的ID =CityDataSource=服务器的ConnectionString =<%$的ConnectionStrings:OA_ConnectionSTring%>中的SelectCommand =SELECT * FROM [cityTbl] ORDER BY CITYNAME>
        < / ASP:SqlDataSource的>
    < /表及GT;
< /身体GT;
< / HTML>


解决方案

您可以使用CSS和后端code的组合。

使用风格='文本转换:大写'的文本框,并在codebehind使用 StreetTxt.Value.ToUpper( );

修改

在这种情况下,您可以使用UPPER函数在ASPX你的命令:
http://msdn.microsoft.com/en-us/library/ms180055.aspx

在StreetDataSource2使用:

 更新命令=更新[StreetTbl]设置[Streetname] = UPPER(@StreetName),[StreetState] = UPPER(@StreetState),[StreetCounty] = UPPER(@StreetCounty) [StreetCity] = UPPER(@StreetCity)凡[ID] = @ID
将InsertCommand =INSERT INTO [streetTbl]([StreetName],[StreetState],[StreetCounty],[StreetCity])VALUES(UPPER(@StreetName),UPPER(@StreetState),UPPER(@StreetCounty),UPPER(@StreetCity) )

I have an asp 4.0 page using a formview and C# code as needed. I have a textbox for "Street Name" add/edit. I have already used CSS text-transform:uppercase which converts the "look" of the text entered to uppercase however the underlying text is in the case used when typing. I need to save the text in my sql database as uppercase.

I have played with various forms of the FindControl on the backend with no luck. I can assign a new variable and populate with the textbox text then change the variable to uppercase (.ToUpper) however I cant determine how to write the variable back to the textbox field.

I hope someone know what I am talking about because I have found many instances of people wanting the textbox text in upper but have found nothing on the text being saved to the database being in all caps.

Here is the code :

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title>Officer Advantage</title>
    <style type="text/css"> 
        .UpperCaseTextField
            {
                text-transform:uppercase;
            }  
    </style> 
        <link rel="shortcut icon" href="~/ImageBase/favicon.ico" type="image/x-icon"/>
        <link rel="icon" href="~/ImageBase/favicon.ico" type="image/x-icon"/>
    </head>
    <body style="background-color:White">
    <form id="StreetFrm" runat="server" onload="LoadStreetRecords">
    <asp:Table ID="HeaderTbl" runat="server" HorizontalAlign="Center" Width="800px" Font-Names="sans-    serif">
        <asp:TableRow ID="HeaderRow_1" runat="server" Width="800px" HorizontalAlign="Center" VerticalAlign="Top">
            <asp:TableCell ID="HeaderCellLeft" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="250px" RowSpan="2"><asp:ImageButton ID="MemberStreetOfficerAdvantageBtn" runat="server" ImageUrl="~/ImageBase/OA_Logo.png" PostBackUrl="~/OA467/Default.aspx" /></asp:TableCell>
            <asp:TableCell ID="HeaderCellMiddle" runat="server" HorizontalAlign="Center" VerticalAlign="Top" Width="300px" RowSpan="2"><asp:ImageButton ID="StreetHeaderLogo" runat="server" ImageUrl="~/ImageBase/Streets_Header.png" /></asp:TableCell>
            <asp:TableCell ID="HeaderCellRight" runat="server" HorizontalAlign="Right" VerticalAlign="Top" Width="250px"><asp:Label ID="HeaderDayDateLab" runat="server"  Font-Bold="True" Font-Size= "Medium" ForeColor="#00AEEF" Text="Label"></asp:Label></asp:TableCell>
        </asp:TableRow>
        <asp:TableRow ID="HeaderRow_2" runat="server" Width="800px" HorizontalAlign="Right" VerticalAlign="Top">
            <asp:TableCell ID="HeaderRow2Col3" runat="server" HorizontalAlign="Right" VerticalAlign="Bottom" Width="250px"><asp:Label ID="HeaderLoginStatus" runat="server"  Font-Bold="True" Font-Size= "Medium" ForeColor="#00AEEF" Text="Welcome, Guest"></asp:Label></asp:TableCell>
        </asp:TableRow>
        <asp:TableRow ID="HeaderRow_3" runat="server" Height="20px" Width="800px" HorizontalAlign="Center" VerticalAlign="Top">
            <asp:TableCell ID="CellTop" runat="server" BackColor="#00AEEF" Height="10px" HorizontalAlign="Center" VerticalAlign="Top" Width="800px" ColumnSpan="3"></asp:TableCell>
        </asp:TableRow>
    </asp:Table>
    <asp:Table ID="StreetTbl_1" runat="server" HorizontalAlign="Center" Width="800px" Font-Names="sans-serif">
        <asp:TableRow ID="StreetTbl_1_Row_1" runat="server" VerticalAlign="Top" Width="800px">
            <asp:TableCell ID="StreetTbl_1_Row_1_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="250px">
                <asp:Table ID="StreetTbl_2" runat="server" HorizontalAlign="Center" Width="250px">
                    <asp:TableRow ID="StreetTbl_2_Row_1" runat="server" VerticalAlign="Top" Width="250px">
                        <asp:TableCell ID="StreetTbl_2_Row_1_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="250px">
                             <asp:Label ID="StreetSelectLab" runat="server"  Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="SELECT STREET"></asp:Label>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow ID="StreetTbl_2_Row_2" runat="server" VerticalAlign="Top" Width="250px">
                        <asp:TableCell ID="StreetTbl_2_Row_2_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="250px" RowSpan="2">
                            <asp:ListBox ID="StreetSelectLbx" runat="server" AutoPostBack="True" DataSourceID="StreetDataSource1" DataTextField="StreetName" DataValueField="ID" Height="425px" Width="240px"  Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" OnSelectedIndexChanged="StreetSelectLbx_SelectedIndexChanged"></asp:ListBox>
                            <asp:SqlDataSource ID="StreetDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:OA_ConnectionString %>" SelectCommand="SELECT * FROM [streetTbl] ORDER BY StreetName"></asp:SqlDataSource>
                        </asp:TableCell>
                    </asp:TableRow>
                </asp:Table>
            </asp:TableCell>
            <asp:TableCell ID="StreetTbl_1_Row_1_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
                <asp:FormView ID="StreetDetailsFvu" runat="server" DataKeyNames="ID" DataSourceID="StreetDataSource2" DefaultMode="ReadOnly" OnItemUpdated="StreetDetailsFvu_ItemUpdated" OnItemInserted="StreetDetailsFvu_ItemInserted">
                <ItemTemplate>
                <asp:Table ID="StreetTbl_3" runat="server" HorizontalAlign="Left" Width="550px">
                    <asp:TableRow ID="StreetTbl_3_Row_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px"> 
                        <asp:TableCell ID="StreetTbl_3_Row_1_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
                            <asp:Label ID="StreetLab" runat="server"  Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="STREET NAME"></asp:Label>
                        </asp:TableCell>
                    </asp:TableRow> 
                    <asp:TableRow ID="StreetTbl_3_Row_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px"> 
                        <asp:TableCell ID="StreetTbl_3_Row_2_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
                            <asp:TextBox ID="StreetTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="540px" Text='<%# Eval("StreetName")%>' CssClass="UpperCaseTextField"></asp:TextBox>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow ID="StreetsTbl_3_Row_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px"> 
                        <asp:TableCell ID="StreetTbl_3_Row_3_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="60px">
                            <asp:Label ID="StreetStateLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="55px" Text="STATE"></asp:Label>
                        </asp:TableCell>
                        <asp:TableCell ID="StreetTbl_3_Row_3_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
                            <asp:Label ID="StreetCountyLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="235px" Text="COUNTY"></asp:Label>
                        </asp:TableCell>
                        <asp:TableCell ID="StreetTbl_3_Row_3_Cell_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
                            <asp:Label ID="StreetCityLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="230px" Text="CITY"></asp:Label>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow ID="StreetsTbl_3_Row_4" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px"> 
                        <asp:TableCell ID="StreetTbl_3_Row_4_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="60px">
                            <asp:TextBox ID="StreetStateTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="55px" Text='<%# Eval("StreetState")%>'></asp:TextBox>
                        </asp:TableCell>
                        <asp:TableCell ID="StreetTbl_3_Row_4_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
                            <asp:TextBox ID="StreetCountyTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="235px" Text='<%# Eval("StreetCounty")%>'></asp:TextBox>
                        </asp:TableCell>
                        <asp:TableCell ID="StreetTbl_3_Row_4_Cell_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
                            <asp:TextBox ID="StreetCityTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="230px" Text='<%# Eval("StreetCity")%>'></asp:TextBox>
                        </asp:TableCell>
                    </asp:TableRow>
                     <asp:TableRow ID="TableRow1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px"> 
                        <asp:TableCell ID="TableCell2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
                            <br />
                            <asp:Label ID="Label1" runat="server"  Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="RECORD ACTIONS"></asp:Label>
                        </asp:TableCell>
                    </asp:TableRow> 
                    <asp:TableRow ID="StreetTbl_3_Row_5" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
                        <asp:TableCell ID="StreetTbl_3_Row_5_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
                            <asp:ImageButton ID="StreetActionsEditBtn" runat="server" CausesValidation="true" OnClick="FormViewChangeToEditMode" ImageUrl="~/ImageBase/Edit.png" />
                            &nbsp;
                            <asp:ImageButton ID="StreetActionsInsertBtn" runat="server" CausesValidation="true" OnClick="FormViewChangeToInsertMode" ImageUrl="~/ImageBase/New.png" />
                        </asp:TableCell>
                    </asp:TableRow>
                </asp:Table>
                </ItemTemplate>
                <EditItemTemplate>
                <asp:Table ID="StreetTbl_3" runat="server" HorizontalAlign="Left" Width="550px">
                    <asp:TableRow ID="StreetTbl_3_Row_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px"> 
                        <asp:TableCell ID="StreetTbl_3_Row_1_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
                            <asp:Label ID="StreetLab" runat="server"  Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="STREET NAME"></asp:Label>
                        </asp:TableCell>
                    </asp:TableRow> 
                    <asp:TableRow ID="StreetTbl_3_Row_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px"> 
                        <asp:TableCell ID="StreetTbl_3_Row_2_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
                            <asp:TextBox ID="StreetTxt" runat="server"  Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="540px" Text='<%# Bind("StreetName")%>' CssClass="UpperCaseTextField"></asp:TextBox>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow ID="StreetsTbl_3_Row_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px"> 
                        <asp:TableCell ID="StreetTbl_3_Row_3_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="60px">
                            <asp:Label ID="StreetStateLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="55px" Text="STATE"></asp:Label>
                        </asp:TableCell>
                        <asp:TableCell ID="StreetTbl_3_Row_3_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
                            <asp:Label ID="StreetCountyLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="235px" Text="COUNTY"></asp:Label>
                        </asp:TableCell>
                        <asp:TableCell ID="StreetTbl_3_Row_3_Cell_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
                            <asp:Label ID="StreetCityLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="230px" Text="CITY"></asp:Label>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow ID="StreetsTbl_3_Row_4" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px"> 
                        <asp:TableCell ID="StreetTbl_3_Row_4_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="60px">
                            <asp:TextBox ID="StreetStateTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="55px" Text='<%# Bind("StreetState")%>'></asp:TextBox>
                        </asp:TableCell>
                        <asp:TableCell ID="StreetTbl_3_Row_4_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
                            <asp:TextBox ID="StreetCountyTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="235px" Text='<%# Bind("StreetCounty")%>'></asp:TextBox>
                        </asp:TableCell>
                        <asp:TableCell ID="StreetTbl_3_Row_4_Cell_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
                            <asp:TextBox ID="StreetCityTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="230px" Text='<%# Bind("StreetCity")%>'></asp:TextBox>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow ID="TableRow1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px"> 
                        <asp:TableCell ID="TableCell2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
                            <br />
                            <asp:Label ID="Label1" runat="server"  Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="RECORD ACTIONS"></asp:Label>
                        </asp:TableCell>
                    </asp:TableRow> 
                    <asp:TableRow ID="StreetTbl_3_Row_5" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
                        <asp:TableCell ID="StreetTbl_3_Row_5_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
                            <asp:ImageButton ID="StreetActionsSaveBtn" runat="server" CausesValidation="true" CommandName="Update" ImageUrl="~/ImageBase/Save.png" />
                            &nbsp;
                            <asp:ImageButton ID="StreetActionsCancelBtn" runat="server" CausesValidation="true" OnClick="FormViewChangeToItemMode" ImageUrl="~/ImageBase/Cancel.png" />
                        </asp:TableCell>
                    </asp:TableRow>
                </asp:Table>
                </EditItemTemplate>
                <InsertItemTemplate>
                <asp:Table ID="StreetTbl_3" runat="server" HorizontalAlign="Left" Width="550px">
                    <asp:TableRow ID="StreetTbl_3_Row_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px"> 
                        <asp:TableCell ID="StreetTbl_3_Row_1_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
                            <asp:Label ID="StreetLab" runat="server"  Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="STREET NAME"></asp:Label>
                        </asp:TableCell>
                    </asp:TableRow> 
                    <asp:TableRow ID="StreetTbl_3_Row_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px"> 
                        <asp:TableCell ID="StreetTbl_3_Row_3_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
                            <asp:TextBox ID="StreetTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="540px" Text='<%# Bind("StreetName")%>' CssClass="UpperCaseTextField"></asp:TextBox>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow ID="StreetsTbl_3_Row_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px"> 
                        <asp:TableCell ID="TableCell1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="60px">
                            <asp:Label ID="StreetStateLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="55px" Text="STATE"></asp:Label>
                        </asp:TableCell>
                        <asp:TableCell ID="StreetTbl_3_Row_3_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
                            <asp:Label ID="StreetCountyLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="235px" Text="COUNTY"></asp:Label>
                        </asp:TableCell>
                        <asp:TableCell ID="StreetTbl_3_Row_3_Cell_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
                            <asp:Label ID="StreetCityLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="230px" Text="CITY"></asp:Label>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow ID="StreetsTbl_3_Row_4" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px"> 
                        <asp:TableCell ID="StreetTbl_3_Row_4_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="60px">
                            <asp:ListBox ID="StreetStateLbx" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="55px" Height="298" DataValueField='StateAbbreviation' DataSourceID="StreetDataSource" DataTextField="StateAbbreviation" SelectedValue='<%# Bind("StreetState") %>'></asp:ListBox>
                        </asp:TableCell>
                        <asp:TableCell ID="StreetTbl_3_Row_4_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
                            <asp:ListBox ID="CountyLbx" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="235px" Height="298" DataValueField='CountyName' DataSourceID="CountyDataSource" DataTextField="CountyName" SelectedValue='<%# Bind("StreetCounty") %>'></asp:ListBox>
                        </asp:TableCell>
                        <asp:TableCell ID="StreetTbl_3_Row_4_Cell_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
                            <asp:ListBox ID="StreetCityTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="230px" Height="298" DataValueField='CityName' DataSourceID="CityDataSource" DataTextField="CityName" SelectedValue='<%# Bind("StreetCity")%>'></asp:ListBox>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow ID="TableRow1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px"> 
                        <asp:TableCell ID="TableCell2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
                            <br />
                            <asp:Label ID="Label1" runat="server"  Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="RECORD ACTIONS"></asp:Label>
                        </asp:TableCell>
                    </asp:TableRow> 
                    <asp:TableRow ID="StreetTbl_3_Row_5" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
                        <asp:TableCell ID="StreetTbl_3_Row_5_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
                            <asp:ImageButton ID="StreetActionsInsertBtn" runat="server" CausesValidation="true" OnDisposed="FormViewChangeToEditMode" CommandName="Insert" ImageUrl="~/ImageBase/Save.png" />
                            &nbsp;
                            <asp:ImageButton ID="StreetActionsCancelBtn" runat="server" CausesValidation="true" OnDisposed="FormViewChangeToEditMode" CommandName="Cancel" ImageUrl="~/ImageBase/Cancel.png" />
                        </asp:TableCell>
                    </asp:TableRow>
                </asp:Table>
                </InsertItemTemplate>
                </asp:FormView>
            </asp:TableCell>
        </asp:TableRow>
    </asp:Table>
        <asp:SqlDataSource ID="StreetDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:OA_ConnectionString %>" SelectCommand="SELECT * FROM [StreetTbl] WHERE ([ID] = @ID)" UpdateCommand="Update [StreetTbl] Set [Streetname] = @StreetName, [StreetState] = @StreetState, [StreetCounty] = @StreetCounty, [StreetCity] = @StreetCity Where [ID] = @ID" InsertCommand="INSERT INTO [streetTbl] ([StreetName], [StreetState], [StreetCounty], [StreetCity]) VALUES (@StreetName, @StreetState, @StreetCounty, @StreetCity)">
            <SelectParameters>
                <asp:ControlParameter ControlID="StreetSelectLbx" DefaultValue="42" Name="ID" PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="ID" Type="Int32" />
                <asp:Parameter Name="StreetName" Type="String" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="ID" Type="Int32" />
                <asp:Parameter Name="StreetName" Type="String" />
            </InsertParameters>
            <DeleteParameters>
            </DeleteParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="StreetDataSource" runat="server" ConnectionString="<%$ ConnectionSTrings:OA_ConnectionSTring %>" SelectCommand="SELECT * FROM [statesTbl] ORDER BY StateAbbreviation">
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="CountyDataSource" runat="server" ConnectionString="<%$ ConnectionSTrings:OA_ConnectionSTring %>" SelectCommand="SELECT * FROM [countyTbl] ORDER BY CountyName">
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="CityDataSource" runat="server" ConnectionString="<%$ ConnectionSTrings:OA_ConnectionSTring %>" SelectCommand="SELECT * FROM [cityTbl] ORDER BY CityName">
        </asp:SqlDataSource>
    </form>
</body>
</html>

解决方案

You can use a combination of the CSS and backend code.

Use style='text-transform:uppercase' on the TextBox, and in your codebehind use StreetTxt.Value.ToUpper();

Edit

In that case you may be able to use the UPPER function in your commands in the ASPX: http://msdn.microsoft.com/en-us/library/ms180055.aspx

In StreetDataSource2 use:

UpdateCommand="Update [StreetTbl] Set [Streetname] = UPPER(@StreetName), [StreetState] = UPPER(@StreetState), [StreetCounty] = UPPER(@StreetCounty), [StreetCity] = UPPER(@StreetCity) Where [ID] = @ID"
InsertCommand="INSERT INTO [streetTbl] ([StreetName], [StreetState], [StreetCounty], [StreetCity]) VALUES (UPPER(@StreetName), UPPER(@StreetState), UPPER(@StreetCounty), UPPER(@StreetCity))"

这篇关于需要文本保存到数据库中大写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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